aboutsummaryrefslogtreecommitdiff
path: root/libctf/ctf-hash.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-09-13 21:53:26 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-10-06 11:18:37 +0100
commit31a8f60f2f31fccc1be955a692f1bd5330f8650d (patch)
tree848371858a7543cb860705bbe05b171c31e1cc4e /libctf/ctf-hash.c
parented3bdac42ce8e545e04bd15a153a85aee4a7a9af (diff)
downloadgdb-31a8f60f2f31fccc1be955a692f1bd5330f8650d.zip
gdb-31a8f60f2f31fccc1be955a692f1bd5330f8650d.tar.gz
gdb-31a8f60f2f31fccc1be955a692f1bd5330f8650d.tar.bz2
gdb: handle unmapped overlays in find_pc_line
I configured and built an m32r-elf toolchain, and ran the gdb.base/overlays.exp test. I saw a couple of errors where GDB would place a breakpoint in the wrong place when placing a breakpoint using a function name, for example in this function: /* 1 */ int foo (int x) /* 2 */ { /* 3 */ if (x) /* 4 */ return some_global_variable; /* 5 */ else /* 6 */ return 0; /* 7 */ } GDB would place the breakpoint on line 2 instead of line 3. The issue is that GDB was failing to skip the prologue correctly. The reason for this is that in m32r-tdep.c:m32r_skip_prologue, we first use find_pc_partial_function to find the functions start and end addresses, then we use find_pc_line to find the start and end of the first line of the function. Currently, if the pc value passed to find_pc_partial_function is in an unmapped overlay then the function start and end addresses that are returned are also the unmapped addresses. However, this is not the case for find_pc_line, here, if the address passed in is in an unmapped overlay then we still get back a symtab_and_line describing the mapped location. What this means is that if a function's mapped location is 0x100 -> 0x120, and its unmapped locations is 0x400 -> 0x420 then we think that the start/end is 0x400 and 0x420 respectively, but the first line might run from 0x100 to 0x108. GDB will then try to scan the prologue starting from 0x400 and ending at 0x108, this immediately gives up as it thinks we have gone past the end of the prologue and the breakpoint is placed at 0x400. In this commit I propose that we change find_pc_line to return addresses in the unmapped range if the address passed in is already in the unmapped range. Now the first line will appear to run from 0x400 to 0x408 and the prologue scanner will correctly find the end of the prologue. With this commit gdb.base/overlays.exp now completely passes with an m32r-elf toolchain. gdb/ChangeLog: * symtab.c (find_pc_line): Return unmapped addresses when the requested address is also unmapped.
Diffstat (limited to 'libctf/ctf-hash.c')
0 files changed, 0 insertions, 0 deletions