binutils-gdb/gdb/dwarf2
Simon Marchi ab557072b8 gdb: use actual DWARF version in compunit's debugformat field
The "info source" command, with a DWARF-compile program, always show
that the debug info is "DWARF 2":

    (gdb) info source
    Current source file is test.c
    Compilation directory is /home/smarchi/build/binutils-gdb/gdb
    Located in /home/smarchi/build/binutils-gdb/gdb/test.c
    Contains 2 lines.
    Source language is c.
    Producer is GNU C17 9.3.0 -mtune=generic -march=x86-64 -g3 -gdwarf-5 -O0 -fasynchronous-unwind-tables -fstack-protector-strong -fstack-clash-protection -fcf-protection.
    Compiled with DWARF 2 debugging format.
    Includes preprocessor macro info.

Change it to display the actual DWARF version:

    (gdb) info source
    Current source file is test.c
    Compilation directory is /home/smarchi/build/binutils-gdb/gdb
    Located in /home/smarchi/build/binutils-gdb/gdb/test.c
    Contains 2 lines.
    Source language is c.
    Producer is GNU C17 9.3.0 -mtune=generic -march=x86-64 -g3 -gdwarf-5 -O0 -fasynchronous-unwind-tables -fstack-protector-strong -fstack-clash-protection -fcf-protection.
    Compiled with DWARF 5 debugging format.
    Includes preprocessor macro info.

The comp_unit_head::version field is guaranteed to be between 2 and 5,
thanks to the check in read_comp_unit_head.  So we can still use static
strings to pass to record_debugformat, and keep it efficient.

In the future, when somebody will update GDB to support DWARF 6, they'll
hit this assert and have to update this code.

Change-Id: I3270b7ebf5e9a17b4215405bd2e365662a4d6172
2021-12-01 21:50:31 -05:00
..
abbrev.c
abbrev.h
attribute.c
attribute.h
comp-unit-head.c
comp-unit-head.h
cu.c gdb: use actual DWARF version in compunit's debugformat field 2021-12-01 21:50:31 -05:00
cu.h
die.h
dwz.c
dwz.h
expr.c
expr.h
frame-tailcall.c
frame-tailcall.h
frame.c
frame.h
index-cache.c gdb: fix help doc for "set index-cache enabled" 2021-11-24 15:07:51 -05:00
index-cache.h
index-common.c
index-common.h
index-write.c
index-write.h
leb.c
leb.h
line-header.c [gdb/symtab] Support .debug_line with DW_FORM_line_strp 2021-11-22 09:14:16 +01:00
line-header.h
loc.c Handle PIE in .debug_loclists 2021-11-10 12:16:40 -07:00
loc.h
macro.c
macro.h
public.h
read.c Allow DW_ATE_UTF for Rust characters 2021-11-29 13:24:32 -07:00
read.h [gdb/symtab] Support .debug_line with DW_FORM_line_strp 2021-11-22 09:14:16 +01:00
sect-names.h
section.c
section.h
stringify.c
stringify.h