From 358be6e72d464349e5146095bdb04b96be5734c1 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 21 Aug 2023 09:55:14 -0600 Subject: Read Ada main name from executable, not inferior An upstream bug report points out this bug: if the user switches from one Ada executable to another without "kill"ing the inferior, then the "start" command will fail. What happens here is that the Ada "main" name is found in a constant string in the executable. But, if the inferior is running, then the process_stratum target reads from the inferior memory. This patch fixes the problem by changing the main name code to set trust-readonly-sections, causing the target stack to read from the executable instead. I looked briefly at changing GNAT to emit DW_AT_main_subprogram instead, but this looks to be pretty involved. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=25811 --- gdb/target.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gdb/target.h') diff --git a/gdb/target.h b/gdb/target.h index 12851f2..aa07075 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -2477,6 +2477,10 @@ extern int remote_timeout; extern scoped_restore_tmpl make_scoped_restore_show_memory_breakpoints (int show); +/* True if we should trust readonly sections from the + executable when reading memory. */ +extern bool trust_readonly; + extern bool may_write_registers; extern bool may_write_memory; extern bool may_insert_breakpoints; -- cgit v1.1