summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/tools/lldb-server/main.cpp
diff options
context:
space:
mode:
authorFrederic Riss <friss@apple.com>2018-04-06 04:28:12 +0000
committerFrederic Riss <friss@apple.com>2018-04-06 04:28:12 +0000
commitcd90f878d4156ef1a732cdd64bc67aa88e7ac2ec (patch)
treed3f7ce21fce68fe4c55bb70b8556b8a6f93fdd0b /lldb/packages/Python/lldbsuite/test/tools/lldb-server/main.cpp
parent1e989deadd26698a3c6f463aad8d636533835cd2 (diff)
downloadbcm5719-llvm-cd90f878d4156ef1a732cdd64bc67aa88e7ac2ec.tar.gz
bcm5719-llvm-cd90f878d4156ef1a732cdd64bc67aa88e7ac2ec.zip
[debugserver] Fix LC_BUILD_VERSION load command handling.
Summary: In one of the 2 places the LC_BUILD_VERSION load command is handled, there is a bug preventing us from actually handling them (the address where to read the load command was not updated). This patch factors reading the deployment target load commands into a helper and adds testing for the 2 code paths calling the helper. The testing is a little bit complicated because the only times those load commands matter is when debugging a simulator process. I added a new decorator to check that a specific SDK is available. The actual testing was fairly easy once I knew how to run a simulated process. Reviewers: jasonmolenda, labath Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D45298 llvm-svn: 329374
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/tools/lldb-server/main.cpp')
-rw-r--r--lldb/packages/Python/lldbsuite/test/tools/lldb-server/main.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/main.cpp b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/main.cpp
index 399c1d35ae6..ca032c120be 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/main.cpp
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/main.cpp
@@ -48,6 +48,8 @@ static const char *const THREAD_COMMAND_NEW = "new";
static const char *const THREAD_COMMAND_PRINT_IDS = "print-ids";
static const char *const THREAD_COMMAND_SEGFAULT = "segfault";
+static const char *const PRINT_PID_COMMAND = "print-pid";
+
static bool g_print_thread_ids = false;
static pthread_mutex_t g_print_mutex = PTHREAD_MUTEX_INITIALIZER;
static bool g_threads_do_segfault = false;
@@ -61,6 +63,10 @@ static char g_message[256];
static volatile char g_c1 = '0';
static volatile char g_c2 = '1';
+static void print_pid() {
+ fprintf(stderr, "PID: %d\n", getpid());
+}
+
static void print_thread_id() {
// Put in the right magic here for your platform to spit out the thread id (tid)
// that debugserver/lldb-gdbserver would see as a TID. Otherwise, let the else
@@ -349,6 +355,8 @@ int main(int argc, char **argv) {
// At this point we don't do anything else with threads.
// Later use thread index and send command to thread.
}
+ } else if (std::strstr(argv[i], PRINT_PID_COMMAND)) {
+ print_pid();
} else {
// Treat the argument as text for stdout.
printf("%s\n", argv[i]);
OpenPOWER on IntegriCloud