This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] re-read symbols before "start"-ing...


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: start-reread.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]