]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/xcoffread.c
Fix line table regression
authorTom Tromey <tom@tromey.com>
Thu, 16 Mar 2023 20:41:31 +0000 (14:41 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 17 Mar 2023 22:17:43 +0000 (16:17 -0600)
commit48e0f38c30a153855e1adc9dc76614f3f88d686a
treefd93b0e93df5852cd5bfcb81e7854fa418234ffb
parent152d9c48a29685752ce06a0248a3f0f490c5660a
Fix line table regression

Simon pointed out a line table regression, and after a couple of false
starts, I was able to reproduce it by hand using his instructions.

The bug is that most of the code in do_mixed_source_and_assembly uses
unrelocated addresses, but one spot does:

  pc = low;

... after the text offset has been removed.

This patch fixes the problem by introducing a new type to represent
unrelocated addresses in the line table.  This prevents this sort of
bug to some degree (it's still possible to manipulate a CORE_ADDR in a
bad way, this is unavoidable).

However, this did let the compiler flag a few spots in that function,
and now it's not possible to compare an unrelocated address from a
line table with an ordinary CORE_ADDR.

Regression tested on x86-64 Fedora 36, though note this setup never
reproduced the bug in the first place.  I also tested it by hand on
the disasm-optim test program.
15 files changed:
gdb/buildsym-legacy.c
gdb/buildsym-legacy.h
gdb/buildsym.c
gdb/buildsym.h
gdb/coffread.c
gdb/dbxread.c
gdb/disasm.c
gdb/dwarf2/read.c
gdb/jit.c
gdb/mdebugread.c
gdb/record-btrace.c
gdb/symmisc.c
gdb/symtab.c
gdb/symtab.h
gdb/xcoffread.c