From d50cf1cea853395da5fcd13c0d116a7332edff26 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 21 Nov 2024 12:32:53 -0700 Subject: Reimplement DAP's stopAtBeginningOfMainSubprogram MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Right now, stopAtBeginningOfMainSubprogram is implemented "by hand", but then later the launch function uses "starti" to implement stopOnEntry. This patch unifies this code and rewrites it to use "start" when appropriate. Reviewed-by: Kévin Le Gouguec --- gdb/python/lib/gdb/dap/launch.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'gdb/python') diff --git a/gdb/python/lib/gdb/dap/launch.py b/gdb/python/lib/gdb/dap/launch.py index 65444bf..6444c8b 100644 --- a/gdb/python/lib/gdb/dap/launch.py +++ b/gdb/python/lib/gdb/dap/launch.py @@ -53,17 +53,19 @@ def launch( if program is not None: file_command(program) inf = gdb.selected_inferior() - if stopAtBeginningOfMainSubprogram: - main = inf.main_name - if main is not None: - exec_and_log("tbreak " + main) inf.arguments = args if env is not None: inf.clear_env() for name, value in env.items(): inf.set_env(name, value) expect_process("process") - exec_and_expect_stop("starti" if stopOnEntry else "run") + if stopAtBeginningOfMainSubprogram: + cmd = "start" + elif stopOnEntry: + cmd = "starti" + else: + cmd = "run" + exec_and_expect_stop(cmd) @request("attach") -- cgit v1.1