[Lldb-commits] [lldb] r128493 - /lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
Jim Ingham
jingham at apple.com
Tue Mar 29 14:45:47 PDT 2011
Author: jingham
Date: Tue Mar 29 16:45:47 2011
New Revision: 128493
URL: http://llvm.org/viewvc/llvm-project?rev=128493&view=rev
Log:
Can't just call "rand" to get a random port, 'cause then you'll get the same sequence in two lldb's. This makes running lldb on lldb not work very well.
Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=128493&r1=128492&r2=128493&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Tue Mar 29 16:45:47 2011
@@ -54,9 +54,16 @@
using namespace lldb;
using namespace lldb_private;
+static bool rand_initialized = false;
+
static inline uint16_t
get_random_port ()
{
+ if (!rand_initialized)
+ {
+ rand_initialized = true;
+ sranddev();
+ }
return (rand() % (UINT16_MAX - 1000u)) + 1000u;
}
More information about the lldb-commits
mailing list