aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lldb/source/Commands/CommandObjectBreakpoint.cpp14
-rw-r--r--lldb/source/Commands/Options.td2
-rw-r--r--lldb/test/API/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py14
3 files changed, 25 insertions, 5 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index 722d5c4..3f88a2f 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -110,7 +110,19 @@ public:
case 't': {
lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID;
if (option_arg[0] != '\0') {
- if (option_arg.getAsInteger(0, thread_id))
+ if (option_arg == "current") {
+ if (!execution_context) {
+ error.SetErrorStringWithFormat("No context to determine current "
+ "thread");
+ } else {
+ ThreadSP ctx_thread_sp = execution_context->GetThreadSP();
+ if (!ctx_thread_sp || !ctx_thread_sp->IsValid()) {
+ error.SetErrorStringWithFormat("No currently selected thread");
+ } else {
+ thread_id = ctx_thread_sp->GetID();
+ }
+ }
+ } else if (option_arg.getAsInteger(0, thread_id))
error.SetErrorStringWithFormat("invalid thread id string '%s'",
option_arg.str().c_str());
}
diff --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td
index 6abb478..b78fb37 100644
--- a/lldb/source/Commands/Options.td
+++ b/lldb/source/Commands/Options.td
@@ -73,7 +73,7 @@ let Command = "breakpoint modify" in {
"index matches this argument.">;
def breakpoint_modify_thread_id : Option<"thread-id", "t">, Group<1>,
Arg<"ThreadID">, Desc<"The breakpoint stops only for the thread whose TID "
- "matches this argument.">;
+ "matches this argument. The token 'current' resolves to the current thread's ID.">;
def breakpoint_modify_thread_name : Option<"thread-name", "T">, Group<1>,
Arg<"ThreadName">, Desc<"The breakpoint stops only for the thread whose "
"thread name matches this argument.">;
diff --git a/lldb/test/API/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py b/lldb/test/API/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
index e5505e1..a8fa0a5 100644
--- a/lldb/test/API/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
+++ b/lldb/test/API/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
@@ -9,11 +9,15 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
-def set_thread_id(thread, breakpoint):
+def using_current(test, thread, breakpoint):
+ bp_id = breakpoint.GetID()
+ test.runCmd("break modify -t current {0}".format(bp_id))
+
+def set_thread_id(test, thread, breakpoint):
id = thread.id
breakpoint.SetThreadID(id)
-def set_thread_name(thread, breakpoint):
+def set_thread_name(test, thread, breakpoint):
breakpoint.SetThreadName("main-thread")
class ThreadSpecificBreakTestCase(TestBase):
@@ -32,6 +36,10 @@ class ThreadSpecificBreakTestCase(TestBase):
def test_thread_name(self):
self.do_test(set_thread_name)
+ @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], archs=['armv7', 'armv7k'], bugnumber='rdar://problem/34563920') # armv7 ios problem - breakpoint with tid qualifier isn't working
+ def test_current_token(self):
+ self.do_test(using_current)
+
def do_test(self, setter_method):
"""Test that we obey thread conditioned breakpoints."""
self.build()
@@ -51,7 +59,7 @@ class ThreadSpecificBreakTestCase(TestBase):
# thread joins the secondary thread, and then the main thread will
# execute the code at the breakpoint. If the thread-specific
# breakpoint works, the next stop will be on the main thread.
- setter_method(main_thread, thread_breakpoint)
+ setter_method(self, main_thread, thread_breakpoint)
process.Continue()
next_stop_state = process.GetState()