[Lldb-commits] [PATCH] Fix TestStubSetSID after unification in to a single lldb-server binary.

Siva Chandra sivachandra at google.com
Fri Feb 20 15:42:53 PST 2015


REPOSITORY
  rL LLVM

================
Comment at: lldb/trunk/test/tools/lldb-gdbserver/commandline/TestStubSetSID.py:42
@@ -36,3 +41,3 @@
     def sid_is_different_with_setsid(self):
-        stub_sid = self.get_stub_sid(" --setsid")
+        stub_sid = self.get_stub_sid(" %s --setsid" % ' '.join(get_common_stub_args()))
         self.assertNotEquals(stub_sid, os.getsid(0))
----------------
vharron wrote:
> ```
> since there's only 0-1 elements in the array, why bother with the join?  Why not just 
> 
> # returns "g" to make lldb-server run in gdbserver mode
> def get_debugserver_mode():
>     return "" if 'darwin' in sys.platform else "g"
> 
> stub_sid = self.get_stub_sid(' %{mode} --setsid'.format(mode=get_debugserver_mode()))
> 
> 
> ```
> Why lists instead of strings?

It is safer to use lists for command args. See for example https://docs.python.org/2.7/library/subprocess.html#popen-constructor

"... it is recommended to pass args as a sequence."

> stub_sid = self.get_stub_sid(' %{mode} --setsid'.format(mode=get_debugserver_mode()))

I do not know if |mode| is relevant terminology in case of debugserver. But if you think it holds for debugserver as well, and that you want this changed, I will do it.

http://reviews.llvm.org/D7801

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the lldb-commits mailing list