diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h index 97eaad79e9da0..c03ff4cfce4ff 100644 --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -1458,6 +1458,12 @@ class Target : public std::enable_shared_from_this, bool GetAutoContinue() const { return m_auto_continue; } + void SetRunAtInitialStop(bool at_initial_stop) { + m_at_initial_stop = at_initial_stop; + } + + bool GetRunAtInitialStop() const { return m_at_initial_stop; } + void GetDescription(Stream &s, lldb::DescriptionLevel level) const; virtual void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const = 0; @@ -1468,6 +1474,7 @@ class Target : public std::enable_shared_from_this, std::unique_ptr m_thread_spec_up; bool m_active = true; bool m_auto_continue = false; + bool m_at_initial_stop = true; StopHook(lldb::TargetSP target_sp, lldb::user_id_t uid); }; @@ -1535,7 +1542,9 @@ class Target : public std::enable_shared_from_this, // Runs the stop hooks that have been registered for this target. // Returns true if the stop hooks cause the target to resume. - bool RunStopHooks(); + // Pass at_initial_stop if this is the stop where lldb gains + // control over the process for the first time. + bool RunStopHooks(bool at_initial_stop = false); size_t GetStopHookSize(); diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 38afadc87791d..446d2492caf89 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -4807,6 +4807,17 @@ class CommandObjectTargetStopHookAdd : public CommandObjectParsed, m_one_liner.push_back(std::string(option_arg)); break; + case 'I': { + bool value, success; + value = OptionArgParser::ToBoolean(option_arg, false, &success); + if (success) + m_at_initial_stop = value; + else + error = Status::FromErrorStringWithFormat( + "invalid boolean value '%s' passed for -F option", + option_arg.str().c_str()); + } break; + default: llvm_unreachable("Unimplemented option"); } @@ -4833,6 +4844,7 @@ class CommandObjectTargetStopHookAdd : public CommandObjectParsed, m_use_one_liner = false; m_one_liner.clear(); m_auto_continue = false; + m_at_initial_stop = true; } std::string m_class_name; @@ -4853,6 +4865,7 @@ class CommandObjectTargetStopHookAdd : public CommandObjectParsed, // Instance variables to hold the values for one_liner options. bool m_use_one_liner = false; std::vector m_one_liner; + bool m_at_initial_stop; bool m_auto_continue = false; }; @@ -5021,6 +5034,9 @@ Filter Options: if (specifier_up) new_hook_sp->SetSpecifier(specifier_up.release()); + // Should we run at the initial stop: + new_hook_sp->SetRunAtInitialStop(m_options.m_at_initial_stop); + // Next see if any of the thread options have been entered: if (m_options.m_thread_specified) { diff --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td index 950652f0e7551..b4dcecf2f765b 100644 --- a/lldb/source/Commands/Options.td +++ b/lldb/source/Commands/Options.td @@ -1053,8 +1053,14 @@ let Command = "target stop hook add" in { Arg<"FunctionName">, Desc<"Set the function name within which the stop hook" " will be run.">, Completion<"Symbol">; def target_stop_hook_add_auto_continue : Option<"auto-continue", "G">, - Arg<"Boolean">, Desc<"The breakpoint will auto-continue after running its" + Arg<"Boolean">, Desc<"The stop-hook will auto-continue after running its" " commands.">; + def target_stop_hook_add_at_initial_stop : Option<"at-initial-stop", "I">, + Arg<"Boolean">, Desc<"Whether the stop-hook will trigger when lldb " + "initially gains control of the process. For a process launch, this " + "initial stop may happen very early on - before the loader has run. You " + "can use this option if you do not want some stop-hooks to run then. " + "Defaults to true.">; } let Command = "thread backtrace" in { diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index ebd0069cb86df..8be1ecffead0f 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -2929,6 +2929,9 @@ Status Process::LoadCore() { "Did not get stopped event after loading the core file."); } RestoreProcessEvents(); + // Since we hijacked the event stream, we will have we won't have run the + // stop hooks. Make sure we do that here: + GetTarget().RunStopHooks(/* at_initial_stop= */ true); } return error; } @@ -3299,6 +3302,9 @@ void Process::CompleteAttach() { : ""); } } + // Since we hijacked the event stream, we will have we won't have run the + // stop hooks. Make sure we do that here: + GetTarget().RunStopHooks(/* at_initial_stop= */ true); } Status Process::ConnectRemote(llvm::StringRef remote_url) { diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 6d4a2ec68ba11..e0a5ad4655035 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -3027,7 +3027,7 @@ void Target::SetAllStopHooksActiveState(bool active_state) { } } -bool Target::RunStopHooks() { +bool Target::RunStopHooks(bool at_initial_stop) { if (m_suppress_stop_hooks) return false; @@ -3036,21 +3036,21 @@ bool Target::RunStopHooks() { // Somebody might have restarted the process: // Still return false, the return value is about US restarting the target. - if (m_process_sp->GetState() != eStateStopped) + lldb::StateType state = m_process_sp->GetState(); + if (!(state == eStateStopped || state == eStateAttaching)) return false; if (m_stop_hooks.empty()) return false; - // If there aren't any active stop hooks, don't bother either. - bool any_active_hooks = false; - for (auto hook : m_stop_hooks) { - if (hook.second->IsActive()) { - any_active_hooks = true; - break; - } - } - if (!any_active_hooks) + + bool no_active_hooks = + llvm::none_of(m_stop_hooks, [at_initial_stop](auto &p) { + bool should_run_now = + !at_initial_stop || p.second->GetRunAtInitialStop(); + return p.second->IsActive() && should_run_now; + }); + if (no_active_hooks) return false; // Make sure we check that we are not stopped because of us running a user @@ -3079,9 +3079,22 @@ bool Target::RunStopHooks() { } // If no threads stopped for a reason, don't run the stop-hooks. + // However, if this is the FIRST stop for this process, then we are in the + // state where an attach or a core file load was completed without designating + // a particular thread as responsible for the stop. In that case, we do + // want to run the stop hooks, but do so just on one thread. size_t num_exe_ctx = exc_ctx_with_reasons.size(); - if (num_exe_ctx == 0) - return false; + if (num_exe_ctx == 0) { + if (at_initial_stop && num_threads > 0) { + lldb::ThreadSP thread_to_use_sp = cur_threadlist.GetThreadAtIndex(0); + exc_ctx_with_reasons.emplace_back( + m_process_sp.get(), thread_to_use_sp.get(), + thread_to_use_sp->GetStackFrameAtIndex(0).get()); + num_exe_ctx = 1; + } else { + return false; + } + } StreamSP output_sp = m_debugger.GetAsyncOutputStream(); @@ -3096,6 +3109,8 @@ bool Target::RunStopHooks() { StopHookSP cur_hook_sp = stop_entry.second; if (!cur_hook_sp->IsActive()) continue; + if (at_initial_stop && !cur_hook_sp->GetRunAtInitialStop()) + continue; bool any_thread_matched = false; for (auto exc_ctx : exc_ctx_with_reasons) { @@ -3472,10 +3487,14 @@ Status Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) { m_process_sp->RestoreProcessEvents(); if (rebroadcast_first_stop) { + // We don't need to run the stop hooks by hand here, they will get + // triggered when this rebroadcast event gets fetched. assert(first_stop_event_sp); m_process_sp->BroadcastEvent(first_stop_event_sp); return error; } + // Run the stop hooks that want to run at entry. + RunStopHooks(true /* at entry point */); switch (state) { case eStateStopped: { @@ -3628,6 +3647,10 @@ Status Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) { true, SelectMostRelevantFrame); process_sp->RestoreProcessEvents(); + // Run the stop hooks here. Since we were hijacking the events, they + // wouldn't have gotten run as part of event delivery. + RunStopHooks(/* at_initial_stop= */ true); + if (state != eStateStopped) { const char *exit_desc = process_sp->GetExitDescription(); if (exit_desc) diff --git a/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py b/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py index b865fd0c0a44f..583e552bb29f7 100644 --- a/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py +++ b/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py @@ -50,7 +50,11 @@ def test_bad_handler(self): def test_stop_hooks_scripted(self): """Test that a scripted stop hook works with no specifiers""" - self.stop_hooks_scripted(5) + self.stop_hooks_scripted(5, "-I false") + + def test_stop_hooks_scripted_no_entry(self): + """Test that a scripted stop hook works with no specifiers""" + self.stop_hooks_scripted(10) def test_stop_hooks_scripted_right_func(self): """Test that a scripted stop hook fires when there is a function match""" diff --git a/lldb/test/API/commands/target/stop-hooks/TestStopHooks.py b/lldb/test/API/commands/target/stop-hooks/TestStopHooks.py index fe59bd8a5d007..6916d86c9b91f 100644 --- a/lldb/test/API/commands/target/stop-hooks/TestStopHooks.py +++ b/lldb/test/API/commands/target/stop-hooks/TestStopHooks.py @@ -47,7 +47,7 @@ def step_out_test(self): def after_expr_test(self): interp = self.dbg.GetCommandInterpreter() result = lldb.SBCommandReturnObject() - interp.HandleCommand("target stop-hook add -o 'expr g_var++'", result) + interp.HandleCommand("target stop-hook add -o 'expr g_var++' -I false", result) self.assertTrue(result.Succeeded(), "Set the target stop hook") (target, process, thread, first_bkpt) = lldbutil.run_to_source_breakpoint( diff --git a/lldb/test/API/commands/target/stop-hooks/on-core-load/TestStopHookOnCoreLoad.py b/lldb/test/API/commands/target/stop-hooks/on-core-load/TestStopHookOnCoreLoad.py new file mode 100644 index 0000000000000..fa142de949057 --- /dev/null +++ b/lldb/test/API/commands/target/stop-hooks/on-core-load/TestStopHookOnCoreLoad.py @@ -0,0 +1,55 @@ +""" +Test that stop hooks fire on core load (first stop) +""" + + +import lldb +import os +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class TestStopOnCoreLoad(TestBase): + NO_DEBUG_INFO_TESTCASE = True + + # This was originally marked as expected failure on Windows, but it has + # started timing out instead, so the expectedFailure attribute no longer + # correctly tracks it: llvm.org/pr37371 + @skipIfWindows + def test_hook_runs_no_threads(self): + # Create core form YAML. + core_path = self.getBuildArtifact("test.core") + self.yaml2obj("test.core.yaml", core_path) + + # Since mach core files don't have stop reasons, we should choose + # the first thread: + self.do_test(core_path, 1) + + def test_hook_one_thread(self): + core_path = os.path.join(self.getSourceDir(), "linux-x86_64.core") + self.do_test(core_path, 3) + + def do_test(self, core_path, stop_thread): + # Set debugger into synchronous mode + self.dbg.SetAsync(False) + + # Create a target by the debugger. + target = self.dbg.CreateTarget("") + + # load the stop hook module and add the stop hook: + stop_hook_path = os.path.join(self.getSourceDir(), "stop_hook.py") + self.runCmd(f"command script import {stop_hook_path}") + self.runCmd("target stop-hook add -P stop_hook.stop_handler") + + # Load core. + process = target.LoadCore(core_path) + self.assertTrue(process, PROCESS_IS_VALID) + # Now run our report command and make sure we get the right answer. + + result = lldb.SBCommandReturnObject() + self.dbg.GetCommandInterpreter().HandleCommand("report_command", result) + print(f"Command Output: '{result.GetOutput}'") + self.assertIn( + f"Stop Threads: {stop_thread}", result.GetOutput(), "Ran the stop hook" + ) diff --git a/lldb/test/API/commands/target/stop-hooks/on-core-load/linux-x86_64.core b/lldb/test/API/commands/target/stop-hooks/on-core-load/linux-x86_64.core new file mode 100644 index 0000000000000..fc27e5810ee58 Binary files /dev/null and b/lldb/test/API/commands/target/stop-hooks/on-core-load/linux-x86_64.core differ diff --git a/lldb/test/API/commands/target/stop-hooks/on-core-load/stop_hook.py b/lldb/test/API/commands/target/stop-hooks/on-core-load/stop_hook.py new file mode 100644 index 0000000000000..d976d2e093ff1 --- /dev/null +++ b/lldb/test/API/commands/target/stop-hooks/on-core-load/stop_hook.py @@ -0,0 +1,30 @@ +import lldb + + +def report_command(debugger, command, exe_ctx, result, internal_dict): + global stop_thread + print(f"About to report out stop_thread: {stop_thread}") + mssg = f"Stop Threads: {stop_thread}" + result.AppendMessage(mssg) + + result.SetStatus(lldb.eReturnStatusSuccessFinishResult) + + +class stop_handler: + def __init__(self, target, extra_args, dict): + global stop_thread + stop_thead = 0 + self.target = target + + def handle_stop(self, exe_ctx, stream): + global stop_thread + thread = exe_ctx.thread + stop_thread = thread.idx + + +def __lldb_init_module(debugger, internal_dict): + global stop_thread + stop_thread = 0 + debugger.HandleCommand( + f"command script add -o -f '{__name__}.report_command' report_command" + ) diff --git a/lldb/test/API/commands/target/stop-hooks/on-core-load/test.core.yaml b/lldb/test/API/commands/target/stop-hooks/on-core-load/test.core.yaml new file mode 100644 index 0000000000000..009c44aa1d1ad --- /dev/null +++ b/lldb/test/API/commands/target/stop-hooks/on-core-load/test.core.yaml @@ -0,0 +1,1056 @@ +--- !mach-o +FileHeader: + magic: 0xFEEDFACF + cputype: 0x01000007 + cpusubtype: 0x00000003 + filetype: 0x00000004 + ncmds: 59 + sizeofcmds: 4384 + flags: 0x00000000 + reserved: 0x00000000 +LoadCommands: + - cmd: LC_THREAD + cmdsize: 208 + PayloadBytes: + - 0x04 + - 0x00 + - 0x00 + - 0x00 + - 0x2A + - 0x00 + - 0x00 + - 0x00 + - 0x01 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x80 + - 0xF7 + - 0xBF + - 0xEF + - 0xFE + - 0x7F + - 0x00 + - 0x00 + - 0x20 + - 0xF6 + - 0xBF + - 0xEF + - 0xFE + - 0x7F + - 0x00 + - 0x00 + - 0x01 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x10 + - 0xF6 + - 0xBF + - 0xEF + - 0xFE + - 0x7F + - 0x00 + - 0x00 + - 0xF0 + - 0xF5 + - 0xBF + - 0xEF + - 0xFE + - 0x7F + - 0x00 + - 0x00 + - 0xF0 + - 0xF5 + - 0xBF + - 0xEF + - 0xFE + - 0x7F + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0xFF + - 0xFF + - 0xFF + - 0xFF + - 0xC8 + - 0xB0 + - 0x70 + - 0xA7 + - 0xFF + - 0x7F + - 0x00 + - 0x00 + - 0xD0 + - 0xB0 + - 0x70 + - 0xA7 + - 0xFF + - 0x7F + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0xA0 + - 0x0F + - 0x00 + - 0x00 + - 0x01 + - 0x00 + - 0x00 + - 0x00 + - 0x46 + - 0x02 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x2B + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x06 + - 0x00 + - 0x00 + - 0x00 + - 0x04 + - 0x00 + - 0x00 + - 0x00 + - 0x03 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x10 + - 0x00 + - 0x02 + - 0xA7 + - 0xFF + - 0x7F + - 0x00 + - 0x00 + - cmd: LC_THREAD + cmdsize: 208 + PayloadBytes: + - 0x04 + - 0x00 + - 0x00 + - 0x00 + - 0x2A + - 0x00 + - 0x00 + - 0x00 + - 0x01 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x80 + - 0xF7 + - 0xBF + - 0xEF + - 0xFE + - 0x7F + - 0x00 + - 0x00 + - 0x20 + - 0xF6 + - 0xBF + - 0xEF + - 0xFE + - 0x7F + - 0x00 + - 0x00 + - 0x01 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x10 + - 0xF6 + - 0xBF + - 0xEF + - 0xFE + - 0x7F + - 0x00 + - 0x00 + - 0xF0 + - 0xF5 + - 0xBF + - 0xEF + - 0xFE + - 0x7F + - 0x00 + - 0x00 + - 0xF0 + - 0xF5 + - 0xBF + - 0xEF + - 0xFE + - 0x7F + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0xFF + - 0xFF + - 0xFF + - 0xFF + - 0xC8 + - 0xB0 + - 0x70 + - 0xA7 + - 0xFF + - 0x7F + - 0x00 + - 0x00 + - 0xD0 + - 0xB0 + - 0x70 + - 0xA7 + - 0xFF + - 0x7F + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0xA0 + - 0x0F + - 0x00 + - 0x00 + - 0x01 + - 0x00 + - 0x00 + - 0x00 + - 0x46 + - 0x02 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x2B + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x06 + - 0x00 + - 0x00 + - 0x00 + - 0x04 + - 0x00 + - 0x00 + - 0x00 + - 0x03 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x00 + - 0x10 + - 0x00 + - 0x02 + - 0xA7 + - 0xFF + - 0x7F + - 0x00 + - 0x00 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 4294967296 + vmsize: 4096 + fileoff: 8192 + filesize: 4096 + maxprot: 5 + initprot: 5 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 4294971392 + vmsize: 4096 + fileoff: 12288 + filesize: 4096 + maxprot: 1 + initprot: 1 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 4294975488 + vmsize: 307200 + fileoff: 16384 + filesize: 307200 + maxprot: 5 + initprot: 5 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 4295282688 + vmsize: 12288 + fileoff: 323584 + filesize: 12288 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 4295294976 + vmsize: 217088 + fileoff: 335872 + filesize: 217088 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 4295512064 + vmsize: 110592 + fileoff: 552960 + filesize: 110592 + maxprot: 1 + initprot: 1 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 4295622656 + vmsize: 8192 + fileoff: 663552 + filesize: 8192 + maxprot: 1 + initprot: 1 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 4295630848 + vmsize: 8192 + fileoff: 671744 + filesize: 8192 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 4295639040 + vmsize: 4096 + fileoff: 679936 + filesize: 4096 + maxprot: 1 + initprot: 1 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 4295643136 + vmsize: 4096 + fileoff: 684032 + filesize: 4096 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 4295651328 + vmsize: 24576 + fileoff: 688128 + filesize: 24576 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 4295684096 + vmsize: 24576 + fileoff: 712704 + filesize: 24576 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 4295712768 + vmsize: 4096 + fileoff: 737280 + filesize: 4096 + maxprot: 1 + initprot: 1 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 4295716864 + vmsize: 8192 + fileoff: 741376 + filesize: 8192 + maxprot: 1 + initprot: 1 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 4296015872 + vmsize: 1048576 + fileoff: 749568 + filesize: 1048576 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 4297064448 + vmsize: 1048576 + fileoff: 1798144 + filesize: 1048576 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 4298113024 + vmsize: 1048576 + fileoff: 2846720 + filesize: 1048576 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 4303355904 + vmsize: 8388608 + fileoff: 3895296 + filesize: 8388608 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140732912369664 + vmsize: 8388608 + fileoff: 12283904 + filesize: 8388608 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140734252867584 + vmsize: 811999232 + fileoff: 20672512 + filesize: 811999232 + maxprot: 5 + initprot: 5 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735863480320 + vmsize: 20553728 + fileoff: 832671744 + filesize: 20553728 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735884034048 + vmsize: 2097152 + fileoff: 853225472 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735886131200 + vmsize: 2097152 + fileoff: 855322624 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735888228352 + vmsize: 2097152 + fileoff: 857419776 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735890325504 + vmsize: 2097152 + fileoff: 859516928 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735892422656 + vmsize: 2097152 + fileoff: 861614080 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735894519808 + vmsize: 2097152 + fileoff: 863711232 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735896616960 + vmsize: 2097152 + fileoff: 865808384 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735898714112 + vmsize: 2097152 + fileoff: 867905536 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735900811264 + vmsize: 2097152 + fileoff: 870002688 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735902908416 + vmsize: 10485760 + fileoff: 872099840 + filesize: 10485760 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735913394176 + vmsize: 4194304 + fileoff: 882585600 + filesize: 4194304 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735917588480 + vmsize: 2097152 + fileoff: 886779904 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735919685632 + vmsize: 2097152 + fileoff: 888877056 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735921782784 + vmsize: 4194304 + fileoff: 890974208 + filesize: 4194304 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735925977088 + vmsize: 4194304 + fileoff: 895168512 + filesize: 4194304 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735930171392 + vmsize: 6291456 + fileoff: 899362816 + filesize: 6291456 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735936462848 + vmsize: 2097152 + fileoff: 905654272 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735938560000 + vmsize: 2097152 + fileoff: 907751424 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735940657152 + vmsize: 2097152 + fileoff: 909848576 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735942754304 + vmsize: 2097152 + fileoff: 911945728 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735944851456 + vmsize: 6291456 + fileoff: 914042880 + filesize: 6291456 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735951142912 + vmsize: 2097152 + fileoff: 920334336 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735953240064 + vmsize: 4194304 + fileoff: 922431488 + filesize: 4194304 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735957434368 + vmsize: 2097152 + fileoff: 926625792 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735959531520 + vmsize: 2097152 + fileoff: 928722944 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735961628672 + vmsize: 20971520 + fileoff: 930820096 + filesize: 20971520 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735982600192 + vmsize: 6291456 + fileoff: 951791616 + filesize: 6291456 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735988891648 + vmsize: 2097152 + fileoff: 958083072 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735990988800 + vmsize: 2097152 + fileoff: 960180224 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735993085952 + vmsize: 2097152 + fileoff: 962277376 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735995183104 + vmsize: 2097152 + fileoff: 964374528 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735997280256 + vmsize: 2097152 + fileoff: 966471680 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140735999377408 + vmsize: 2097152 + fileoff: 968568832 + filesize: 2097152 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140736001474560 + vmsize: 1302528 + fileoff: 970665984 + filesize: 1302528 + maxprot: 3 + initprot: 3 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140736937222144 + vmsize: 219267072 + fileoff: 971968512 + filesize: 219267072 + maxprot: 1 + initprot: 1 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140737486258176 + vmsize: 4096 + fileoff: 1191235584 + filesize: 4096 + maxprot: 1 + initprot: 1 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: '' + vmaddr: 140737487028224 + vmsize: 4096 + fileoff: 1191239680 + filesize: 4096 + maxprot: 5 + initprot: 5 + nsects: 0 + flags: 0 +... diff --git a/lldb/test/API/python_api/event/TestEvents.py b/lldb/test/API/python_api/event/TestEvents.py index fb1a7e3bc6d3a..4a1b0d82c5c32 100644 --- a/lldb/test/API/python_api/event/TestEvents.py +++ b/lldb/test/API/python_api/event/TestEvents.py @@ -411,8 +411,9 @@ def test_shadow_listener(self): self.runCmd(f"command script import {stop_hook_path}") import stop_hook + # Add our stop hook here, don't report on the initial attach: self.runCmd( - f"target stop-hook add -P stop_hook.StopHook -k instance -v {self.instance}" + f"target stop-hook add -P stop_hook.StopHook -k instance -v {self.instance} -I false" ) self.stop_counter = 0