From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] re-read symbols before "start"-ing...
Date: Tue, 08 Mar 2005 06:45:00 -0000 [thread overview]
Message-ID: <20050308064529.GB18053@adacore.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1994 bytes --]
Humpf,
I thought I checked that this scenario was working:
- build first (Ada program, main program name is "first")
- build second (Ada program, main program name is "second")
- mv first common
- gdb
(gdb) file common
(gdb) start
--> lands in "first"
- mv common first
- mv second common
- (gdb) start
--> lands in "second"
I thought I checked that this was working because I added an
executable-changed notification just for that. In reality, it
doesn't work. When I tried a new testcase that I am currently
writing, here is what I actually get:
(gdb) start^M
Breakpoint 2 at 0x804980b: file /home/no-backup/brobecke/testing/gdb-public/gdb/testsuite/gdb.ada/exec_changed/first.adb, line 4.^M
`/home/no-backup/brobecke/testing/gdb-public/gdb/testsuite/gdb.ada/exec_changed/common' has changed; re-reading symbols.^M
Error in re-setting breakpoint 2:^M
Function "_ada_first" not defined.^M
Error in re-setting breakpoint 2:^M
Function "_ada_first" not defined.^M
Error in re-setting breakpoint 2:^M
Function "_ada_first" not defined.^M
Error in re-setting breakpoint 2:^M
Function "_ada_first" not defined.^M
^M
Program exited normally.^M
(gdb) FAIL: gdb.ada/exec_changed.exp: start second
What happens here is that we insert the breakpoint *before* the
notification is received. So we end up using the cached value
for the main procedure name, which is out of date. The answer
is to make sure the symbols are re-read if the executable has
changed.
Bad point for me, sorry... Fortunatly, only Ada is affected for now.
Attached is a patch.
2005-03-07 Joel Brobecker <brobecker@adacore.com>
* infcmd.c (start_command): Make sure the symbols are up to date
before setting the temporary breakpoint.
Tested on x86-linux. This fixes the FAIL above. Otherwise, the results
are identical.
OK to commit?
Thanks,
--
Joel
[-- Attachment #2: start-reread.diff --]
[-- Type: text/plain, Size: 853 bytes --]
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.134
diff -p -r1.134 infcmd.c
*** infcmd.c 21 Feb 2005 03:25:56 -0000 1.134
--- infcmd.c 8 Mar 2005 06:43:05 -0000
*************** start_command (char *args, int from_tty)
*** 512,517 ****
--- 512,523 ----
the user changes its mind. */
kill_if_already_running (from_tty);
+ /* Make sure that the symbols are up to date. Otherwise, we might
+ end up inserting the temporary breakpoint before we receive the
+ executable-changed notification, potentially causing us to use
+ the wrong function name as the main procedure. */
+ reread_symbols ();
+
/* Insert the temporary breakpoint, and run... */
tbreak_command (main_name (), 0);
run_command (args, from_tty);
next reply other threads:[~2005-03-08 6:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-08 6:45 Joel Brobecker [this message]
2005-03-08 13:48 ` Daniel Jacobowitz
2005-03-08 21:28 ` Joel Brobecker
2005-03-08 21:45 ` Daniel Jacobowitz
2005-03-08 22:12 ` Joel Brobecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050308064529.GB18053@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox