I see for some program at gdb startup:
...
Samples: 102K of event 'cycles:pu', Event count (approx.): 91710925103
Overhead Command Shared Object Symbol
15.21% gdb gdb [.]
lnp_state_machine::handle_special
...
where the divisions are the places we stall. The following
micro-optimizes things but it smells like m_line_header->line_range
is constant, likewise probably m_line_header->maximum_ops_per_instruction
so eventually the divisions could be avoided completely with some
lookup table.
Well. Micro-optimizing with this patch improves things
(don't expect [load] CSE over the gdbarch_adjust_dwarf2_line call).
Build and reg-tested on x86_64-linux.
gdb/ChangeLog:
2020-02-14 Richard Biener <rguenther@suse.de>
* dwarf2/read.c (lnp_state_machine::handle_special_opcode): Apply CSE
on expression with division operators.
When running test-case gdb.ada/ptype_tagged_param.exp, I get:
...
PASS: gdb.ada/ptype_tagged_param.exp: compilation foo.adb
...
However, when I then de-install gnatmake and run again, I get the same result.
This is due to a stale exec. After removing the stale exec, I get:
...
UNSUPPORTED: gdb.ada/ptype_tagged_param.exp: compilation foo.adb
...
Fix this removing the stale exec in gdb_compile_ada before compilation.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-02-13 Tom de Vries <tdevries@suse.de>
* lib/ada.exp (gdb_compile_ada): Delete stale exec before compilation.
If I de-install gnatbind, I run into:
...
FAIL: gdb.ada/catch_ex_std.exp: gnatbind foo
...
Fix this by marking the test unsupported instead:
...
UNSUPPORTED: gdb.ada/catch_ex_std.exp: gnatbind foo
...
Likewise for gnatlink.
Tested on x86_64-linux, with and without gnatbind/gnatlink installed.
gdb/testsuite/ChangeLog:
2020-02-13 Tom de Vries <tdevries@suse.de>
* gdb.ada/catch_ex_std.exp: Indicate unsupported if gnatbind/gnatlink
are missing.
After de-installing gnatmake, I get:
...
Running src/gdb/testsuite/gdb.ada/rename_subscript_param.exp ...
ERROR: tcl error sourcing src/gdb/testsuite/gdb.ada/rename_subscript_param.exp.
ERROR: couldn't execute "gnatmake": no such file or directory
while executing
"exec $gnatmake --version"
(procedure "gnatmake_version_at_least" line 4)
...
Fix this by wrapping the exec call in a catch call.
Tested with and withouth gnatmake installed on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-02-13 Tom de Vries <tdevries@suse.de>
* lib/ada.exp (gnatmake_version_at_least): Wrap exec call in a catch
call.
This removes some dead code from event-loop.c.
This patch is from my old series to merge the gdb and gdbserver event
loops; but since it is just removing dead code, it seemed simple to
commit it separately.
gdb/ChangeLog
2020-02-12 Tom Tromey <tom@tromey.com>
* event-loop.c (event_data, gdb_event, event_handler_func):
Remove.
Now that comp_unit and the remaining frame data are all independent of
the objfile, it can all be stored on the BFD and shared across
inferiors.
As with other code doing this same thing, care must be taken to not
share the data when the objfile requires relocations. So, two keys
are used: one for the BFD and one for the objfile, and
gdb_bfd_requires_relocations is used to differentiate between the two
cases.
gdb/ChangeLog
2020-02-12 Tom Tromey <tom@tromey.com>
* dwarf2/frame.c (dwarf2_frame_bfd_data): New global.
(dwarf2_frame_objfile_data): Add comment.
(find_comp_unit, set_comp_unit): New functions.
(dwarf2_frame_find_fde): Use find_comp_unit.
(dwarf2_build_frame_info): Use set_comp_unit.
This removes the objfile backlink from comp_unit. The only remaining
uses involved fetching the text offset from the objfile. However,
this is already conveniently computed at all the sites that call
execute_cfa_program, and so it can simply be passed in.
gdb/ChangeLog
2020-02-12 Tom Tromey <tom@tromey.com>
* dwarf2/frame.c (struct comp_unit) <objfile>: Remove.
(comp_unit): Don't initialize objfile.
(execute_cfa_program): Add text_offset parameter.
(execute_cfa_program_test, dwarf2_fetch_cfa_info)
(dwarf2_frame_cache): Update.
(dwarf2_build_frame_info): Don't set "objfile" member.
The DWARF frame comp_unit object still has a backlink to the objfile.
In order to be truly objfile-independent, this must be removed.
This patch removes one such use, by passing the gdbarch to
decode_frame_entry directly.
gdb/ChangeLog
2020-02-12 Tom Tromey <tom@tromey.com>
* dwarf2/frame.c (decode_frame_entry_1): Add gdbarch parameter.
(decode_frame_entry): Likewise.
(dwarf2_build_frame_info): Update.
This adds an auto_obstack to the DWARF frame comp_unit object, and
then changes the remaining code here to use the comp_unit obstack
rather than the objfile obstack.
At this point, all the storage for frame data is self-contained --
that is, it is independent of the objfile.
gdb/ChangeLog
2020-02-12 Tom Tromey <tom@tromey.com>
* dwarf2/frame.c (struct comp_unit) <obstack>: New member.
(decode_frame_entry_1): Use the comp_unit obstack.
This changes the DWARF frame code to store the comp_unit on the
objfile, rather than storing the FDE table. It also changes the
comp_unit to be heap-allocated using "new".
This change makes it simpler for a later patch to add a field to the
comp_unit, and to have deallaction work properly. This in turn is
important for making the frame data be independent of the objfile.
gdb/ChangeLog
2020-02-12 Tom Tromey <tom@tromey.com>
* dwarf2/frame.c (struct comp_unit): Add initializers and
constructor.
(dwarf2_frame_objfile_data): Store a comp_unit.
(dwarf2_frame_find_fde): Update.
(dwarf2_build_frame_info): Use "new".
This removes struct dwarf2_fde_table, replacing it with a typedef of
std::vector. This simplifies the code somewhat.
gdb/ChangeLog
2020-02-12 Tom Tromey <tom@tromey.com>
* dwarf2/frame.c (struct dwarf2_fde_table): Remove.
(dwarf2_fde_table): Typedef for std::vector.
(dwarf2_frame_objfile_data): Remove the deleter. Now static.
(dwarf2_frame_find_fde, add_fde, decode_frame_entry_1)
(decode_frame_entry): Update.
(dwarf2_build_frame_info): Use "new".
I am keeping the (int) casts because a future patch will change the type
to bool.
gdb/ChangeLog:
2020-02-12 Christian Biesinger <cbiesinger@google.com>
* arm-tdep.c (arm_dump_tdep): Print more fields of tdep.
The type dwarf_expr_baton is unused and can be removed.
gdb/ChangeLog
2020-02-12 Tom Tromey <tom@tromey.com>
* dwarf2/loc.c (struct dwarf_expr_baton): Remove.
Change-Id: Id8342da31398b9b4b08f31be7c3d612e9590bbbf
When using configure flag --with-iconv-bin=$(which iconv), we run into:
...
gdb/charset.c: In function 'void find_charset_names()':
gdb/charset.c:821:75: error: missing sentinel in function call [-Werror=format=]
iconv_program = concat (iconv_dir.c_str(), SLASH_STRING, "iconv", NULL);
^
cc1plus: all warnings being treated as errors
...
Fix the warning.
Build and reg-tested on x86_64-linux.
2020-02-12 Lukas Durfina <ldurfina@tachyum.com>
Tom de Vries <tdevries@suse.de>
* charset.c (find_charset_names): Cast concat NULL sentinel to char *.
This updates a comment in psymtab.h to reflect the current reality.
gdb/ChangeLog
2020-02-11 Tom Tromey <tom@tromey.com>
* psymtab.h: Update comment.
Change-Id: I438bb5929c3ebd1a4c6e9a902490f2ef63014ab3
Add DISABLE_COPY_AND_ASSIGN to struct auto_obstack, to prevent copying
it. Copying an auto_obstack would be a bug.
2020-02-11 Tom Tromey <tom@tromey.com>
* gdb_obstack.h (struct auto_obstack): Use
DISABLE_COPY_AND_ASSIGN.
Change-Id: Ic9e5ab20acfcfa61c241fed4d99bbb1caefba3cd
dwarf2/frame.h forward-declares struct objfile, but there's no need
for this.
gdb/ChangeLog
2020-02-11 Tom Tromey <tom@tromey.com>
* dwarf2/frame.h (struct objfile): Don't forward declare.
Change-Id: I4d54d46ac9422eeb64dc5f0b934792e77a875aa5
The non-deprecated equivalent is implementing the gdbarch function
iterate_over_regset_sections, this patch does that.
Tested by generating a core file on cris under qemu and comparing
the output of "info registers".
This also fixes this warning when loading cris core files:
warning: Unexpected size of section `.reg/164' in core file.
gdb/ChangeLog:
2020-02-11 Christian Biesinger <cbiesinger@google.com>
* cris-tdep.c (cris_supply_gregset): Change signature to match
what struct regset expects.
(cris_regset): New struct.
(fetch_core_registers): Remove.
(cris_iterate_over_regset_sections): New function.
(_initialize_cris_tdep): Don't call deprecated_add_core_fns.
(cris_gdbarch_init): Call set_gdbarch_iterate_over_regset_sections.
Change-Id: Ieef895b5a2fdc797d1a913cd1c0c07563edfe8e7
I'm dealing with a Fedora GDB bug that is related to PR tui/25126, and
I thought I'd write a specific testcase for it because I couldn't find
one.
The idea is to get the simple reproducer from the bug and tweak the
testcase around it. This one was a bit hard because, since we need to
modify the source file and recompile it, it involved a bit of TCL-foo
to do things. Also for this reason, I'm only enabling the test for
native boards.
I tested this with an upstream GDB and made sure everything is
passing. I also tested with a faulty GDB and made sure the test
failed.
gdb/testsuite/ChangeLog:
2020-02-11 Sergio Durigan Junior <sergiodj@redhat.com>
PR tui/25126
https://bugzilla.redhat.com/show_bug.cgi?id=1784210
* gdb.base/cached-source-file.c: New file.
* gdb.base/cached-source-file.exp: New file.
Change-Id: Ib1b074342ebe8613c6d1dfde631691ebdf6d81c6
These are for the obsolete FPA architecture.
gdb/ChangeLog:
2020-02-11 Christian Biesinger <cbiesinger@google.com>
* arch/arm.h (enum gdb_regnum): Add comment for the FP0..7
registers.
Change-Id: I6920616318ee637493d4ca12b91fa2ebcd103d76
In my previous commit, I did a last minute modification of warning.m4,
but forgot to re-generate the configure scripts, this commit fixes that.
gdb/ChangeLog:
* configure: Re-generate.
gdbserver/ChangeLog:
* configure: Re-generate.
gdbsupport/ChangeLog:
* configure: Re-generate.
Commit 85f0dd3ce ("[gdb] Fix -Wstrict-null-sentinel warnings") fixed
some violations of -Wstrict-null-sentinel. If we want to enforce this
warning, I think we should enable it in our warning.m4 file.
gdbsupport/ChangeLog:
* warning.m4: Add -Wstrict-null-sentinel.
* configure: Re-generate.
gdbserver/ChangeLog:
* configure: Re-generate.
gdb/ChangeLog:
* configure: Re-generate.
This file is used by gdbsupport, gdbserver and gdb, so I think it
belongs in gdbsupport. Move it there and update the references the
various acinclude.m4 files.
gdbsupport/ChangeLog:
* warning.m4: Move here, from gdb/warning.m4.
* acinclude.m4: Update warning.m4 path.
* Makefile.in: Re-generate.
gdbserver/ChangeLog:
* acinclude.m4: Update warning.m4 path.
gdb/ChangeLog:
* acinclude: Update warning.m4 path.
* warning.m4: Move to gdbsupport.
The test-case gdb.server/server-kill-python.exp runs fine by itself:
...
Running src/gdb/testsuite/gdb.server/server-kill-python.exp ...
=== gdb Summary ===
nr of expected passes 3
...
But if we run f.i. gdb.server/file-transfer.exp before it, we get instead:
...
Running src/gdb/testsuite/gdb.server/server-kill-python.exp ...
ERROR: GDB process no longer exists
=== gdb Summary ===
nr of expected passes 13
nr of unresolved testcases 1
...
We can see the origin of the problem here:
...
spawn gdbserver --once localhost:2347 \
build/gdb/testsuite/outputs/gdb.server/file-transfer/file-transfer \
build/gdb/testsuite/outputs/gdb.server/server-kill-python/server-kill-python^M
Process build/gdb/testsuite/outputs/gdb.server/file-transfer/file-transfer
\ created; pid = 9464^M
Listening on port 2347^M
...
The spawn of the gdbserver for the server-kill-python test-case gets as
executable argument the file-transfer binary.
This is caused by proc gdbserver_spawn attempting to load the exec file in
$file_last_loaded. This is something that is meant to load the same exec in
the gdbserver that was earlier loaded into gdb.
In this test-case however, nothing has been loaded into gdb by the test-case,
and consequently we load the file that was loaded into gdb in the previous
test-case.
Fix this by unsetting $file_last_loaded in gdb_init.
Build and reg-tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-02-11 Tom de Vries <tdevries@suse.de>
PR testsuite/25488
* lib/gdb.exp (gdb_init): Unset $file_last_loaded.
Change-Id: Ic385e08cbd34cbf85518720cf5695b4ff6619f4b
When passed in CXXFLAGS, -Wstrict-null-sentinel triggers twice in a
gdb/gdbserver build.
Fix the two occurrences.
Build and reg-tested on x86_64-linux.
gdb/ChangeLog:
2020-02-10 Tom de Vries <tdevries@suse.de>
* dwarf2/read.c (process_psymtab_comp_unit_reader): Cast concat NULL
sentinel to char *.
gdbsupport/ChangeLog:
2020-02-10 Tom de Vries <tdevries@suse.de>
* environ.c (gdb_environ::set): Cast concat NULL sentinel to char *.
Pre-commit 919adfe840 "Move gdbserver to top level", if we build gdb with
--disable-gdbserver, and run test-case gdb.multi/multi-target.exp, we run
into:
...
(gdb) PASS: gdb.multi/multi-target.exp: continue: non-stop=off: set remote-exec file in inferior 2
spawn of --once --multi localhost:2346 failed
ERROR: tcl error sourcing /data/gdb_versions/devel/src/gdb/testsuite/gdb.multi/multi-target.exp.
ERROR: Timeout waiting for gdbserver response.
...
Fix this by using skip_gdbserver_tests in multi-target.exp.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-02-10 Tom de Vries <tdevries@suse.de>
* gdb.multi/multi-target.exp: Skip if skip_gdbserver_tests.
Fix a catastrophic failure in gdb.base/step-over-no-symbols.exp where
remote target communication issues cause the value of the PC retrieved
to be empty:
(gdb) FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: stepi
p /x $pc
Remote 'g' packet reply is too long (expected 264 bytes, got 532 bytes): 00000000000000002a6f61551500000080faffff3f0000000028010000000000b03857551500000060ad5f5515000000906e615515000000802401000000000090faffff3f00000000000000000000000100000000000000e8fbffff3f000000f8fbffff3f0000000000000000000000b8faffff3f0000008a05010000000000589c6f551500000056424d40435c2f7c1809575515000000f0e0baaa2a0000000000000000000000f0ffbaaa2a000000f0e0baaa2a0000006804baaa2a000000000000000000000000000000000000007053baaa2a0000008252b2aa2a00000090fe01000000000048e056551500000004000000000000004000000000000000920501000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000xxxxxxxxxxxxxxxx00000000
(gdb) FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: get after PC
ERROR: tcl error sourcing .../gdb/testsuite/gdb.base/step-over-no-symbols.exp.
ERROR: missing operand at _@_
in expression " _@_!= "
(parsing expression " != ")
invoked from within
"expr $before_addr != $after_addr"
("uplevel" body line 1)
invoked from within
"uplevel 1 expr $condition"
(procedure "gdb_assert" line 6)
invoked from within
"gdb_assert {$before_addr != $after_addr} "advanced""
(procedure "test_step_over" line 36)
invoked from within
"test_step_over $displaced"
("uplevel" body line 2)
invoked from within
"uplevel 1 $body"
invoked from within
"with_test_prefix "displaced=$displaced" {
test_step_over $displaced
}"
("foreach" body line 6)
invoked from within
"foreach displaced { "off" "on" "auto" } {
if { $displaced != "off" && ![support_displaced_stepping] } {
continue
}
with_test_prefix "dis..."
(file ".../gdb/testsuite/gdb.base/step-over-no-symbols.exp" line 84)
invoked from within
"source .../gdb/testsuite/gdb.base/step-over-no-symbols.exp"
("uplevel" body line 1)
invoked from within
"uplevel #0 source .../gdb/testsuite/gdb.base/step-over-no-symbols.exp"
invoked from within
"catch "uplevel #0 source $test_file_name""
Remote debugging from host xxx.xxx.xxx.xxx, port 47130
monitor exit
Killing process(es): 1092
Remote communication error. Target disconnected.: Connection reset by peer.
(gdb)
To do so verify first, before making an arithmetic comparison, that the
values to compare are actually integers (using a string comparison would
result in a false PASS if both operands were empty, as in this case),
making the test script proceed normally:
(gdb) FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: stepi
p /x $pc
Remote 'g' packet reply is too long (expected 264 bytes, got 532 bytes): 00000000000000002a6f61551500000080faffff3f0000000028010000000000b03857551500000060ad5f5515000000906e615515000000802401000000000090faffff3f00000000000000000000000100000000000000e8fbffff3f000000f8fbffff3f0000000000000000000000b8faffff3f0000008a05010000000000589c6f5515000000424d40435c2f7c7c1809575515000000f0e0baaa2a0000000000000000000000f0ffbaaa2a000000f0e0baaa2a0000006804baaa2a000000000000000000000000000000000000007053baaa2a0000008252b2aa2a00000090fe01000000000048e056551500000004000000000000004000000000000000920501000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000xxxxxxxxxxxxxxxx00000000
(gdb) FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: get after PC
FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: advanced
Remote debugging from host xxx.xxx.xxx.xxx, port 48404
monitor exit
Killing process(es): 1795
Remote communication error. Target disconnected.: Connection reset by peer.
(gdb)
Note the double curly braces, to take advantage of `&&' operator's lazy
evaluation.
gdb/testsuite/
* gdb.base/step-over-no-symbols.exp: Verify that $before_addr
and $after_addr are both integers before making a comparison.
Say we're debugging a test-case with CUs with name "<artificial>", meaning
not originating from a single file compilation, and use the verbose setting:
...
$ gdb -iex "set verbose on" -batch cc1
Reading symbols from cc1...
Reading in symbols for <artificial>... \
and /tmp/trunk/gcc/attribs.c... \
...
and /tmp/trunk/gcc/tree-ssa-reassoc.c... \
done.
...
From the "/tmp/trunk/gcc/attribs.c" message, it's clear which CU is loaded. But
that's not the case for the "<artificial>" message.
The message uses the filename field of struct partial_symtab, which is
documented like this:
...
/* Name of the source file which this partial_symtab defines,
or if the psymtab is anonymous then a descriptive name for
debugging purposes, or "". It must not be NULL. */
...
So, fix this by setting the filename field to a more descriptive name than
"<artificial>", by appending the CU offset.
This way, we print instead:
...
$ gdb -iex "set verbose on" -batch cc1
Reading symbols from cc1...
Reading in symbols for <artificial>@0x41146d9 \
and /tmp/trunk/gcc/attribs.c... \
... \
and /tmp/trunk/gcc/tree-ssa-reassoc.c... \
done.
...
Build and reg-tested on x86_64-linux.
gdb/ChangeLog:
2020-02-09 Tom de Vries <tdevries@suse.de>
* dwarf2read.c (process_psymtab_comp_unit_reader): Append CU offset to
filename if it matches "<artificial>".
When running test-case gdb.base/many-headers.exp, we have test output on
stdout/stderr:
...
Running src/gdb/testsuite/gdb.base/many-headers.exp ...
[New LWP 759]
Core was generated by `outputs/gdb.base/many-headers/many'.
Program terminated with signal SIGSEGV, Segmentation fault.
\#0 0x0000000000400688 in ?? ()
=== gdb Summary ===
nr of expected passes 1
...
Furthermore, the only trace in gdb.log that we have of the gdb command issued
is:
...
PASS: gdb.base/many-headers.exp: read core file
...
Fix this by echoing the gdb command in gdb.log, and capturing the
command output and pasting it into gdb.log:
...
( ulimit -s 4096; \
gdb -nw -nx -data-directory data-directory -batch -core=many-headers.core )
[New LWP 1542]
Core was generated by `many'.
Program terminated with signal SIGSEGV, Segmentation fault.
\#0 0x0000000000400688 in ?? ()
PASS: gdb.base/many-headers.exp: read core file
...
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-02-09 Tom de Vries <tdevries@suse.de>
* gdb.base/many-headers.exp: Echo gdb command to gdb.log. Capture gdb
command output and paste it into gdb.log. If any, paste catch message
to gdb.log.
cutu_reader has a "keep" parameter, which is used to decide what to do
with a new CU when the reader is destroyed. Most code does not try to
preserve the CU, so this patch removes this parameter and instead adds
a new method that users can call to preserve the CU on the chain.
gdb/ChangeLog
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (class cutu_reader) <cutu_reader,
init_tu_and_read_dwo_dies>: Remove "keep" parameter.
<keep>: Declare method.
<m_keep>: Remove member.
<~cutu_reader>: Remove.
(cutu_reader::init_tu_and_read_dwo_dies): Update.
(cutu_reader::cutu_reader): Update.
(cutu_reader::keep): Rename from ~cutu_reader.
(process_psymtab_comp_unit, build_type_psymtabs_1)
(process_skeletonless_type_unit, load_partial_comp_unit)
(load_full_comp_unit, dwarf2_read_addr_index)
(read_signatured_type): Update.
Change-Id: I859b1c64313569d76d46317c14e9b077ebc3a27b
This changes the "want_partial_unit" parameters to have type bool, and
also removes the parameter from process_psymtab_comp_unit_reader.
This latter change seemed like an improvement, because it avoids a
pointless function call in the case where we are not planning to read
a partial unit.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (process_psymtab_comp_unit_reader): Remove
"want_partial_unit" parameter.
(process_psymtab_comp_unit): Change want_partial_unit to bool.
Inline check for DW_TAG_partial_unit.
(dwarf2_build_psymtabs_hard, scan_partial_symbols): Update.
Change-Id: I99e647f0c4faa3346e90a6e7bacc82af57eccff1
This moves read_n_bytes and read_direct_string to be with the the
low-level value-reading code.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (read_n_bytes, read_direct_string): Move to
read.c.
* dwarf2/leb.h (read_n_bytes, read_direct_string): Move from
read.c.
Change-Id: Id07bfa13d93c0ac1f47a385749a8f01f4755b818
This changes read_address to be a method on comp_unit_head.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (read_address): Move to comp-unit.c.
(dwarf2_rnglists_process, dwarf2_ranges_process)
(read_attribute_value, dwarf_decode_lines_1)
(var_decode_location, decode_locdesc): Update.
* dwarf2/comp-unit.c (comp_unit_head::read_address): Move from
read.c. Remove "cu" parameter.
* dwarf2/comp-unit.h (struct comp_unit_head) <read_address>: New
method.
Change-Id: Ibd6c7235f2e4d5fd88c272cfd2c3d3328618cc56
This changes one of the read_offset overloads to be a method on
comp_unit_head.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (read_attribute_value, read_indirect_string)
(read_indirect_line_string): Update.
* dwarf2/comp-unit.c (read_offset): Remove.
(read_comp_unit_head): Update.
* dwarf2/comp-unit.h (struct comp_unit_head) <read_offset>: New
method.
(read_offset): Don't declare.
Change-Id: Ia595702a5748337b7c031352bc437956baab9990
This creates the new files dwarf2/comp-unit.[ch], moving
comp_unit_head and helpers to those files. A couple of functions are
turned into methods, because it was convenient to do so now.
2020-02-08 Tom Tromey <tom@tromey.com>
* Makefile.in (COMMON_SFILES): Add dwarf2/comp-unit.c.
* dwarf2/read.c (struct comp_unit_head): Move to
dwarf2/comp-unit.h.
(enum class rcuh_kind): Move to comp-unit.h.
(get_cu_length, offset_in_cu_p): Now methods on comp_unit_head.
(read_comp_unit_head, error_check_comp_unit_head)
(read_and_check_comp_unit_head): Move to comp-unit.c.
(read_offset, dwarf_unit_type_name): Likewise.
(create_debug_type_hash_table, read_cutu_die_from_dwo)
(cutu_reader::cutu_reader, read_call_site_scope)
(find_partial_die, follow_die_offset): Update.
* dwarf2/comp-unit.h: New file, from dwarf2read.c.
Change-Id: Id961b9674c0081ed061083c8152c38b27b27388a
This moves read_offset_1 to leb.c, as it is a low-level data-reading
function. It is also renamed to remove the "_1", because gdb can use
overloading now, and this is clearer.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (read_offset_1): Move to leb.c.
(read_abbrev_offset, read_offset, dwarf_decode_line_header)
(dwarf_decode_macro_bytes): Update.
* dwarf2/leb.c (read_offset): Rename; move from read.c.
* dwarf2/leb.h (read_offset): Declare.
Change-Id: I048140598acfa76eade2cc529ab7933d4b9ca0b3
This changes dwarf2_section_size to be a method on
dwarf2_section_info.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (dwarf2_section_size): Remove.
(error_check_comp_unit_head, dwarf2_symbol_mark_computed):
Update.
* dwarf2/section.h (struct dwarf2_section_info) <get_size>: New method.
Change-Id: I12928fee5c84350ce98883e329357b86888d639b
There are two implementations of read_initial_length in gdb. This
merges them and moves the resulting function to leb.c.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (read_initial_length): Move to leb.c.
* dwarf2/leb.h (read_initial_length): Declare.
* dwarf2/leb.c (read_initial_length): Move from read.c. Add
handle_nonstd parameter.
* dwarf2/frame.c (read_initial_length): Remove.
(decode_frame_entry_1): Update.
Change-Id: I34d37bad0f8a584bfa781432cba25e05e1bd5750
This moves dwarf2_per_cu_data::imported_symtabs earlier, near where
the other data members are located.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.h (struct dwarf2_per_cu_data) <imported_symtabs>:
Move earlier.
Change-Id: I314ddaa6f67c53a848e513b3f6d42913bd957833
This moves the line_header class to a pair of new files, making
dwarf2/read.c somewhat smaller.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.h (dwarf_line_debug): Declare.
* Makefile.in (COMMON_SFILES): Add dwarf2/line-header.c.
* dwarf2/read.c: Move line_header code to new files.
(dwarf_line_debug): No longer static.
* dwarf2/line-header.c: New file.
* dwarf2/line-header.h: New file.
Change-Id: I8d9d8a2398b4e888e20cc5dd68d041c28b5a06e3
This changes the two new line_table methods to return
unique_xmalloc_ptr. This removes a bit of manual memory management.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (struct line_header) <file_full_name,
file_file_name>: Return unique_xmalloc_ptr.
(line_header::file_file_name): Update.
(line_header::file_full_name): Update.
(dw2_get_file_names_reader): Update.
(macro_start_file): Update.
Change-Id: I9442dba43882fb26097d0770a291eea2b03913a4
This changes file_full_name and file_file_name methods to be methods
on line_header. This seems more clear to me.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (struct line_header) <file_full_name,
file_file_name>: Declare methods.
(dw2_get_file_names_reader): Update.
(file_file_name): Now a method.
(file_full_name): Likewise.
(macro_start_file): Update.
Change-Id: I50d3e91665a9637c732e1e8d8e4263764c766d9c