binutils-gdb/gdb/python
Joel Brobecker 305e13e67f Fix regression introduced in "break *<EXPR>" by explicit location patches.
A relatively recent patch support for explicit locations, and part
of that patch cleaned up the way we parse breakpoint locations.
Unfortunatly, a small regression crept in for "*<EXPR>" breakpoint
locations. In particular, on PIE programs, one can see the issue by
doing the following, with any program:

    (gdb) b *main
    Breakpoint 1 at 0x51a: file hello.c, line 3.
    (gdb) run
    Starting program: /[...]/hello
    Error in re-setting breakpoint 1: Warning:
    Cannot insert breakpoint 1.
    Cannot access memory at address 0x51a

    Warning:
    Cannot insert breakpoint 1.
    Cannot access memory at address 0x51a

Just for the record, this regression was introduced by:

    commit a06efdd6ef
    Date:   Tue Aug 11 17:09:35 2015 -0700
    Subject: Explicit locations: introduce address locations

What happens is that the patch makes the implicit assumption that
the address computed the first time is static, as if it was designed
to only support litteral expressions (Eg. "*0x1234"). This allows
the shortcut of not re-computing the breakpoint location's address
when re-setting breakpoints.

However, this does not work in general, as demonstrated in the example
above.

This patch plugs that hole simply by saving the original expression
used to compute the address as part of the address location, so as
to then re-evaluate that expression during breakpoint re-set.

gdb/ChangeLog:

        * location.h (new_address_location): Add new parameters
        "addr_string" and "addr_string_len".
        (get_address_string_location): Add declaration.
        * location.c (new_address_location): Add new parameters
        "addr_string" and "addr_string_len".  If not NULL, store
        a copy of the addr_string in the new location as well.
        (get_address_string_location): New function.
        (string_to_event_location): Update call to new_address_location.
        * linespec.c (event_location_to_sals) <ADDRESS_LOCATION>:
        Save the event location in the parser's state before
        passing it to convert_address_location_to_sals.
        * breakpoint.c (create_thread_event_breakpoint): Update call
        to new_address_location.
        (init_breakpoint_sal): Get the event location's string, if any,
        and use it to update call to new_address_location.
        * python/py-finishbreakpoint.c (bpfinishpy_init):
        Update call to new_address_location.
        * spu-tdep.c (spu_catch_start): Likewise.

        * config/djgpp/fnchange.lst: Add entries for
        gdb/testsuite/gdb.base/break-fun-addr1.c and
        gdb/testsuite/gdb.base/break-fun-addr2.c.

gdb/testsuite/ChangeLog:

        * gdb.base/break-fun-addr.exp: New file.
        * gdb.base/break-fun-addr1.c: New file.
        * gdb.base/break-fun-addr2.c: New file.
2016-01-21 14:23:15 +04:00
..
lib/gdb Fix sorting of enum values in FlagEnumerationPrinter 2016-01-20 13:44:33 -05:00
py-arch.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-auto-load.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-block.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-bpevent.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-breakpoint.c Per-inferior/Inferior-qualified thread IDs 2016-01-13 10:59:43 +00:00
py-cmd.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-continueevent.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-event.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-event.h GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-events.h GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-evtregistry.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-evts.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-exitedevent.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-finishbreakpoint.c Fix regression introduced in "break *<EXPR>" by explicit location patches. 2016-01-21 14:23:15 +04:00
py-frame.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-framefilter.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-function.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-gdb-readline.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-inferior.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-infevents.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-infthread.c Add Python InferiorThread.global_num attribute 2016-01-13 11:00:54 +00:00
py-lazy-string.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-linetable.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-newobjfileevent.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-objfile.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-param.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-prettyprint.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-progspace.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-signalevent.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-stopevent.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-stopevent.h GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-symbol.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-symtab.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-threadevent.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-type.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-unwind.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-utils.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-value.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-varobj.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
py-xmethods.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
python-config.py
python-internal.h GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
python.c Limit breakpoint re-set to the current program space 2016-01-19 12:18:14 +00:00
python.h GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00