Invoking -var-info-path-expression on a dynamic varobj lead either in wrong
(nonsense) result or to a segmentation fault in cplus_describe_child().
This was caused by the fact that varobj_get_path_expr() called
cplus_path_expr_of_child() ignoring the fact the parent of the variable
is dynamic. Then, cplus_describe_child() accessed the underlaying C type
members by index, causing (i) either wrong (nonsense) expression being
returned (since dynamic child may be completely arbibtrary value)
or (ii) segmentation fault (in case the index higher than number of
underlaying C type members.
This fixes the problem by checking whether a varobj is a child of a dynamic
varobj and, if so, reporting an error as described in documentation.
gdb/ChangeLog:
* varobj.c (varobj_get_path_expr_parent): Report an error if
parent is a dynamic varobj.
gdb/testsuite/Changelog:
* gdb.python/py-mi-var-info-path-expression.c: New file.
* gdb.python/py-mi-var-info-path-expression.py: New file.
* gdb.python/py-mi-var-info-path-expression.exp: New file.
I noticed that re-generating our gnulib import introduced some changes.
I supposed that this comes from the recent upgrade to autoconf 2.69
(though I haven't checked).
Tested by rebuilding on GNU/Linux x86-64 and mingw (cross-compiled from
GNU/Linux).
gdb/ChangeLog:
* gnulib/aclocal.m4: Re-generate.
* gnulib/config.in: Re-generate.
* gnulib/configure: Re-generate.
* gnulib/import/Makefile.in: Re-generate.
* gnulib/import/m4/gnulib-comp.m4: Re-generate.
* gnulib/import/m4/onceonly.m4: Re-generate.
Looking at the address sanitizer output, this was a quite low hanging
fruit. We create target_desc objects for testing that we never free.
Saving them in unique_ptrs takes care of it.
I created a small struct to hold these because I thought it would help
readability.
gdb/ChangeLog:
* target-descriptions.c (struct xml_test_tdesc): New.
(xml_tdesc): Change type to std::vector<xml_test_tdesc>.
(record_xml_tdesc): Update.
(maintenance_check_xml_descriptions): Update.
* target-descriptions.h (record_xml_tdesc): Update comment.
On commit:
commit 7f1f7e2393
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Fri Jul 13 16:20:34 2018 -0400
Expect for another variant of error message when gdbserver cannot resolve hostname
I extended the regular expression being used to identify whether
gdbserver could not resolve a (host)name. This was needed because the
error message being printed had a different variation across some
systems. However, as it turns out, I've just noticed that the message
has yet another variation:
target remote tcp8:123:2353
tcp8:123:2353: cannot resolve name: System error
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tcp8:123:2353: No such file or directory.
(gdb) FAIL: gdb.server/server-connect.exp: tcp8: connect to gdbserver using tcp8:123
which is causing FAILs on some systems (namely, Fedora-i686 on
BuildBot).
So instead of trying to predict everything that can be printed, I
decided to just match anything after the "cannot resolve name: " part.
This patch implements that.
Regression tested on the BuildBot.
gdb/testsuite/ChangeLog:
2018-07-30 Sergio Durigan Junior <sergiodj@redhat.com>
* lib/gdbserver-support.exp (gdbserver_start): Match any kind of
error after "cannot resolve name" string.
In commit:
commit 37cc0caeca
Date: Wed Jul 18 13:38:35 2018 +0200
[gdb/exp] Interpret size of vla with unknown size as <optimized out>
All dynamic types are treated as arrays in the 'sizeof' code path,
which means that structures can incorrectly be treated as arrays.
This can cause a failure in the gdb.base/vla-datatypes.exp test
script.
This commit adds a check that we do have an array before checking the
array bounds, and I also check that the array index type is dynamic
too. This second check probably isn't strictly necessary, but
shouldn't hurt, a non-dynamic index type shouldn't have undefined high
bound.
gdb/ChangeLog:
* eval.c (evaluate_subexp_for_sizeof): Check for array type before
checking array bounds are defined.
I noticed a buildbot failure where gdb crashed in info-os.exp, when
compiled with -D_GLIBCXX_DEBUG:
(gdb) info os procgroups
/usr/include/c++/7/bits/stl_algo.h:4834:
Error: comparison doesn't meet irreflexive requirements, assert(!(a < a)).
Objects involved in the operation:
iterator::value_type "< operator type" {
type = pid_pgid_entry;
}
The bug here is that pid_pgid_entry::operator< violates the C++
irreflexivity rule; that is, that an object cannot be less than
itself.
Tested locally by re-running info-os.exp.
gdb/ChangeLog
2018-07-30 Tom Tromey <tom@tromey.com>
* nat/linux-osdata.c (pid_pgid_entry::operator<): Fix
irreflexivity violation.
This removes dead code that, according to the comments, existed to
placate lint. I don't think this has been relevant in a long time,
and certainly not since gdb switched to C++.
Tested by rebuilding.
ChangeLog
2018-07-30 Tom Tromey <tom@tromey.com>
* cli/cli-decode.c (lookup_cmd): Remove lint code.
* value.c (unpack_long): Remove lint code.
* valops.c (value_ind): Remove lint code.
* valarith.c (value_x_binop, value_x_unop, value_equal)
(value_pos): Remove lint code.
The gdb_load_shlib function will, on remote targets, try to run some
GDB commands. This obviously isn't going to work unless GDB is
running.
The gdb.trace/tspeed.exp test calls gdb_load_shlib before starting
GDB. Don't do that.
The failure that's triggered is actually DeJaGNU complaining that the
variable $use_gdb_stub doesn't exist, this is only created when GDB is
started. Something like this should trigger a failure:
make check-gdb \
RUNTESTFLAGS="--target_board=remote-gdbserver-on-localhost \
gdb.trace/tspeed.exp"
This commit also adds a check to gdb_load_shlib that GDB is running.
The check is always performed, so this should catch cases where a GDB
developer adds a use of gdb_load_shlib but doesn't test their code
with a remote target.
gdb/testsuite/ChangeLog:
* gdb.trace/tspeed.exp: Only call gdb_load_shlib after gdb has
started.
* lib/gdb.exp (gdb_load_shlib): Call perror if GDB is not running.
At -O3 -g -gstrict-dwarf, gcc generates for an optimized out vla 'a' a
DW_TAG_variable with type DW_TAG_array_type containing one
DW_TAG_subrange_type, but without DW_AT_upper_bound or DW_AT_count, which
makes the upper bound value 'unknown':
...
.uleb128 0x15 # (DIE (0x161) DW_TAG_variable)
.long 0xec # DW_AT_abstract_origin
.long 0x170 # DW_AT_type
...
.uleb128 0xa # (DIE (0x170) DW_TAG_array_type)
.long 0x110 # DW_AT_type
.long 0x17f # DW_AT_sibling
.uleb128 0x17 # (DIE (0x179) DW_TAG_subrange_type)
.long 0xc6 # DW_AT_type
.byte 0 # end of children of DIE 0x170
...
But gdb prints '0' for the size of 'a':
...
/gdb ./vla-1.exe -batch -ex "b f1" -ex "run" -ex "p sizeof(a)"
Breakpoint 1 at 0x4004c0: f1. (2 locations)
Breakpoint 1, f1 (i=<optimized out>) at vla-1.c:18
18 }
$1 = 0
...
while <optimized out> would be more appropriate.
This patch fixes that in evaluate_subexp_for_sizeof.
Build and reg-tested on x86_64-linux.
2018-07-28 Tom de Vries <tdevries@suse.de>
* eval.c (evaluate_subexp_for_sizeof): Interpret size of dynamic type
with undefined upper bound as <optimized out>.
* gdb.base/vla-optimized-out-o3-strict.exp: New file.
Ref.: https://bugs.debian.org/904628
It has been reported that gcore's manpage is a bit imprecise when it
comes to two things:
- It doesn't explicity say that the command accepts more than one PID
on its CLI.
- It fails to mention that the argument passed through the "-o" option
is actually a prefix that will be used to compose the corefile's
filename, and not the actual filename.
I decided to give it a try and rewrite parts of the text to further
clarify these two points. I ended up rewording the "Description"
section because, IMHO, it was a bit confuse to understand.
To make things consistent, I've also renamed the "$name" variable in
the gcore.in script, and expanded the usage text.
gdb/doc/ChangeLog:
2018-07-27 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.texinfo (gcore man): Rewrite "Description" and "-o"
option sections to further clarify that gcore can take more
than one PID, and that "-o" is used to specify a prefix, not a
filename.
gdb/ChangeLog:
2018-07-27 Sergio Durigan Junior <sergiodj@redhat.com>
* gcore.in: Rename variable "name" to "prefix". Expand
"usage" text.
After f6ac5f3d "Convert struct target_ops to C++", we need to explicitly use
the global namespace when calling ::close() from windows_nat_target methods,
as that object has a close() method.
gdb/ChangeLog:
2018-07-14 Jon Turney <jon.turney@dronecode.org.uk>
* windows-nat.c (windows_nat_target::create_inferior): Update to
call close() in global namespace.
This patch finally makes partial symbols and partial symtabs
independent of the program space.
Specifically:
It changes add_psymbol_to_list to accept a section index, and changes
the psymbol readers to pass this. At the same time it removes the
code to add the objfile's section offset to the psymbol.
It adds an objfile argument to the psymtab textlow and texthigh
accessors and changes some code to use the raw variants instead.
It removes the "relocate" method from struct quick_symbol_functions,
as it is no longer needed any more.
It changes partial_symbol::address so that the relevant offset is now
applied at the point of use.
gdb/ChangeLog
2018-07-26 Tom Tromey <tom@tromey.com>
* dwarf-index-write.c (add_address_entry): Don't add objfile
offsets.
* dbxread.c (find_stab_function): Rename from
find_stab_function_addr. Return a bound_minimal_symbol.
(read_dbx_symtab): Use raw_text_low, raw_text_high.
Don't add objfile offsets.
(end_psymtab): Use raw_text_low, raw_text_high,
MSYMBOL_VALUE_RAW_ADDRESS.
(read_ofile_symtab): Update.
(process_one_symbol): Update.
* dwarf2read.c (create_addrmap_from_index): Don't add objfile
offsets.
(dw2_relocate): Remove.
(dw2_find_pc_sect_symtab): Bias PC by the text offset before
searching addrmap.
(dwarf2_gdb_index_functions, dwarf2_debug_names_functions):
Update.
(process_psymtab_comp_unit_reader, add_partial_symbol)
(add_partial_subprogram, dwarf2_ranges_read): Update.
(load_partial_dies): Update.
(add_address_entry): Don't add objfile offsets.
(dwarf2_build_include_psymtabs): Update.
(create_addrmap_from_aranges): Don't add objfile offsets.
(dw2_find_pc_sect_compunit_symtab): Update.
* mdebugread.c (parse_symbol): Don't add objfile offsets.
(parse_lines): Remove 'pst' parameter, replace with 'textlow'.
Update.
(parse_partial_symbols): Don't add objfile offsets. Use
raw_text_low, raw_text_high. Update.
(handle_psymbol_enumerators, psymtab_to_symtab_1): Update.
* objfiles.c (objfile_relocate1): Don't relocate psymtabs_addrmap
or call 'relocate' quick function. Clear psymbol_map.
* psympriv.h (struct partial_symbol) <address>: Add section
offset.
<set_unrelocated_address>: Rename from set_address.
<raw_text_low, raw_text_high>: New methods.
<text_low, text_high>: Add objfile parameter.
(add_psymbol_to_bcache): Add 'section' parameter. Call
set_unrelocated_address.
* psymtab.c (find_pc_sect_psymtab_closer, find_pc_sect_psymtab)
(find_pc_psymbol): Update.
(fixup_psymbol_section, relocate_psymtabs): Remove.
(dump_psymtab, psym_functions): Update.
(add_psymbol_to_bcache, add_psymbol_to_list): Add 'section'
parameter.
(maintenance_info_psymtabs, maintenance_check_psymtabs): Update.
(start_psymtab_common): Update.
* symfile-debug.c (debug_qf_relocate): Remove.
(debug_sym_quick_functions): Update.
* symfile.h (struct quick_symbol_functions) <relocate>: Remove.
* xcoffread.c (scan_xcoff_symtab): Don't add objfile offsets.
Update.
Right now some psymtab code checks whether a psymtab's textlow or
texthigh fields are valid by comparing against 0.
I imagine this is mildly wrong in the current environment, but once
psymtabs are relocated dynamically, it will no longer be correct,
because it will be much more normal to see a psymtab with a textlow of
zero -- this will just mean it appears at the start of the text
section.
This patch introduces validity bits to handle this situation more
nicely, and changes users of the code to follow.
gdb/ChangeLog
2018-07-26 Tom Tromey <tromey@redhat.com>
* dbxread.c (end_psymtab): Use text_high_valid and
text_low_valid.
* mdebugread.c (parse_partial_symbols): Use text_low_valid.
(psymtab_to_symtab_1): Use text_high_valid and text_low_valid.
* psympriv.h (struct partial_symtab) <m_text_low, m_text_high>:
Update comment.
<text_low_valid, text_high_valid>: New fields.
<set_text_low, set_text_high>: Update.
* xcoffread.c (scan_xcoff_symtab): Use text_low_valid.
This introduces accessors for the partial symbol table textlow and
texthigh fields. This lets us later arrange to relocate these values
at their point of use.
I did this conversion by renaming the fields. I didn't rename the
fields back afterward, thinking that on the off chance that someone
has a patch touching this area, then a merge would helpfully break
their compile.
I looked at making the fields private, but this interferes with the
memset in allocate_psymtab, and I didn't want to chase this down.
This conversion can be done later if need be.
gdb/ChangeLog
2018-07-26 Tom Tromey <tom@tromey.com>
* dbxread.c (read_dbx_symtab, end_psymtab, read_ofile_symtab):
Update.
* dwarf2read.c (dwarf2_create_include_psymtab): Don't initialize
textlow and texthigh fields.
(process_psymtab_comp_unit_reader, dwarf2_build_include_psymtabs):
Update.
* mdebugread.c (parse_lines, parse_partial_symbols)
(psymtab_to_symtab_1): Update.
* psympriv.h (struct partial_symtab) <m_text_low, m_text_high>:
Rename fields. Update comment. Now private.
<text_low, text_high, set_text_low, set_text_high>: New methods.
* psymtab.c (find_pc_sect_psymtab_closer, find_pc_sect_psymtab)
(find_pc_sect_psymbol, relocate_psymtabs, dump_psymtab)
(start_psymtab_common, maintenance_info_psymtabs)
(maintenance_check_psymtabs): Update.
* xcoffread.c (xcoff_end_psymtab): Don't initialize textlow and
texthigh fields.
(scan_xcoff_symtab): Update.
This introduces a partial_symbol::address method. This method takes
an objfile argument. This is necessary so that we can later relocate
a partial symbol at its point of use. It also adds an accessor to
compute the unrelocated value; and a method to be used for setting the
field.
Note that the new method doesn't actually perform any relocation yet.
That will come in a subsequent patch. However, the comments are
written to reflect the intended, rather than the temporary, semantics.
gdb/ChangeLog
2018-07-26 Tom Tromey <tromey@redhat.com>
* psympriv.h (struct partial_symbol) <unrelocated_address,
address, set_address>: New methods.
* psymtab.c (find_pc_sect_psymtab_closer, find_pc_sect_psymbol)
(fixup_psymbol_section, relocate_psymtabs): Update.
(print_partial_symbols): Add 'objfile' parameter. Update.
(dump_psymtab, add_psymbol_to_bcache, psym_fill_psymbol_map):
Update.
This is the psymbol analog to the patch to change the representation
of minimal symbols:
https://sourceware.org/ml/gdb-patches/2013-10/msg00524.html
It has the same rationale: namely, that we're going to change the code
to apply psymbol offsets at runtime. This will be done by adding an
argument to the SYMBOL_VALUE_ADDRESS macro -- but since we can't
convert all the symbol types at once, we need a new approach.
Because gdb now is in C++, this patch changes partial_symbol to
inherit from general_symbol_info, rather than renaming the field.
This simplifies code in some places.
Also, as noted before, these macros implement a kind of "phony
polymorphism" that is not actually useful in practice; so this patch
removes the macros in favor of simply referring directly to members.
In a few cases -- obj_section in this patch and the symbol address in
the future -- methods will be used instead.
Note that this removes the blanket memset from add_psymbol_to_bcache.
This hasn't really been needed since bcache was modified to allow
holes in objects and since psymtab took advantage of that. This
deletion was required due to changing partial_symbol to derive from
general_symbol_info.
gdb/ChangeLog
2018-07-26 Tom Tromey <tom@tromey.com>
* dwarf-index-write.c (write_psymbols, debug_names::insert)
(debug_names::write_psymbols): Update.
* psympriv.h (struct partial_symbol): Derive from
general_symbol_info.
<obj_section>: New method.
(PSYMBOL_DOMAIN, PSYMBOL_CLASS): Remove.n
* psymtab.c (find_pc_sect_psymtab_closer, find_pc_sect_psymtab)
(find_pc_sect_psymbol, fixup_psymbol_section)
(match_partial_symbol, lookup_partial_symbol, relocate_psymtabs)
(print_partial_symbols, recursively_search_psymtabs)
(compare_psymbols, psymbol_hash, psymbol_compare)
(add_psymbol_to_bcache, maintenance_check_psymtabs)
(psymbol_name_matches, psym_fill_psymbol_map): Update.
I noticed that there is a bit of dead code in end_psymtab.
This deletes it.
Normally I would investigate a fix for the code. However, considering
that the code has been this way a long time (since the first import to
sourceware) and considering that dbxread.c is not as important any
more, I think it's safe to just consider that there's no bug.
gdb/ChangeLog
2018-07-26 Tom Tromey <tromey@redhat.com>
* dbxread.c (end_psymtab): Remove dead code.
Add a maintenance command to disable the DWARF stack unwinders.
Normal users would not need this feature, but it is useful to allow
extended testing of fallback stack unwinding strategies, for example,
prologue scanners.
This is a partial implementation of the idea discussed in pr gdb/8434,
which talks about a generic ability to disable any frame unwinder.
Being able to arbitrarily disable any frame unwinder would be a more
complex patch, and I was unsure how useful such a feature would really
be, however, I can see (and have) a real need to disable DWARF
unwinders. That's why this patch only targets that specific set of
unwinders.
If in the future we find ourselves adding more switches to disable
different unwinders, then we should probably move to a more generic
solution, and remove this patch.
gdb/ChangeLog:
* dwarf2-frame-tailcall.c (tailcall_frame_sniffer): Exit early if
DWARF unwinders are disabled.
* dwarf2-frame.c: Add dwarf2read.h include.
(dwarf2_frame_sniffer): Exit early if DWARF unwinders are
disabled.
(dwarf2_frame_unwinders_enabled_p): Define.
(show_dwarf_unwinders_enabled_p): New function.
(_initialize_dwarf2_frame): Register switch to control DWARF
unwinder use.
* dwarf2-frame.h (dwarf2_frame_unwinders_enabled_p): Declare.
* dwarf2read.c (set_dwarf_cmdlist): Remove static keyword.
(show_dwarf_cmdlist): Remove static keyword.
* dwarf2read.h (set_dwarf_cmdlist): Declare.
(show_dwarf_cmdlist): Declare.
* NEWS: Document new feature.
gdb/doc/ChangeLog:
* gdb.texinfo (Maintenance Commands): Add description of
maintenance command to control dwarf unwinders.
gdb/testsuite/ChangeLog:
* gdb.base/maint.exp: Add check that dwarf unwinders control flag
is visible.
With the test-case contained in this patch and compiled for debug we run into
a segfault with trunk gdb:
...
$ gdb catch-follow-exec -batch -ex "catch exec" \
-ex "set follow-exec-mode new" -ex "run" -ex "info prog"
Catchpoint 1 (exec)
process xxx is executing new program: /usr/bin/ls
[New inferior 2 (process 0)]
[New process xxx]
Thread 2.1 "ls" hit Catchpoint 1 (exec'd /usr/bin/ls), in _start () from
/lib64/ld-linux-x86-64.so.2
Segmentation fault (core dumped)
...
The patch fixes the segfault by returning an error in info_program_command
if get_last_target_status returns minus_one_ptid.
The test-case is non-standard, because the standard approach runs into
PR23368, a problem with gdb going to the background.
Build and reg-tested on x86_64-linux.
2018-07-26 Tom de Vries <tdevries@suse.de>
PR breakpoints/23366
* infcmd.c (info_program_command): Handle ptid == minus_one_ptid.
* gdb.base/catch-follow-exec.c: New test.
* gdb.base/catch-follow-exec.exp: New file.
This patch generates a warning if DW_AT_upper_bound or DW_AT_count is defined,
but can't be translated. This is triggered for current gcc in lto mode for
vla test-cases.
Build and reg-tested on x86_64-linux.
2018-07-26 Tom de Vries <tdevries@suse.de>
* dwarf2read.c (read_subrange_type): Warn if DW_AT_upper_bound or
DW_AT_count can't be translated to a dynamic prop.
When compiling vla-optimized-out.c with -O3 and a recent gcc, and trying to
print the vla a in f1, we run into this gdb exception:
...
Cannot find matching parameter at DW_TAG_call_site 0x4003be at main
...
This is a regression introduced by 42dc7699a2 "[gdb/exp] Fix printing of type
of optimized out vla".
This patch fixes the regression by wrapping the ctx.eval call in
dwarf2_locexpr_baton_eval in try/catch, similar to what is done in
dwarf2_evaluate_loc_desc_full.
Build and reg-tested on x86_64-linux.
2018-07-25 Tom de Vries <tdevries@suse.de>
* dwarf2loc.c (dwarf2_locexpr_baton_eval): Wrap ctx.eval call in
try/catch.
* gdb.base/vla-optimized-out-o3.exp: New file. Reuse
vla-optimized-out.c.
When a single breakpoint location enableness was modified by a CLI
command, observers were not notified about it. This issue is now fixed.
gdb/ChangeLog:
* breakpoint.c (enable_disable_bp_num_loc): Notify observers.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-breakpoint-location-ena-dis.cc: New file.
* gdb.mi/mi-breakpoint-location-ena-dis.exp: New file.
This patch is another attempt at really fixing the multitude of assertions
being seen where symbols of one language are being added to symbol lists of
another language.
In this specific case, the backtrace command (thread apply all bt full) that
is looking for the compunit containing the PC of the thread. That calls
get_prev_frame several times. This function calls (eventually)
dwarf2_frame_prev_register. That eventually ends up calling
find_pc_compunit_symtab.
In this function (find_pc_sect_compunit_symtab actually), we loop over all
compunits, calling the "quick" function dw2_find_pc_sect_compunit_symtab.
That function calls dw2_instantiate_symtab to read in all the CU's symbols.
Now the fun begins.
dw2_do_instantiate_symtab queues the per_cu for reading, using a default
"pretend" language of language_minimal with the expectation that this will
be set later.
The DIEs of this (only queued) CU are then processed.
The first DIE is DW_TAG_compile_unit. That's handled by read_file_scope.
(Nearly) The first thing read_file_scope does is:
get_scope_pc_bounds (die, &lowpc, &highpc, cu);
This function loops over the children of the current DIE (a compile_unit),
looking for bounds. The first such child is a subprogram, and we attempt to
get its bounds. We use dwarf2_attr to get at DW_AT_high_pc.
This subprogram has DW_AT_specification set, so dwarf_attr (via
follow_die_ref/follow_die_offset) will follow that, but follow_die_offset
*also* attempts to load the containing CU for the spec DIE. That spec DIE
lives inside a CU that is a partial_unit and has no language attribute. So
it simply inherits the language from the CU that elicited the read. [That
all happens in follow_die_offset.]
The original CU's language is still language_minimal -- we haven't gotten to
the line in read_file_scope that actually sets the language yet!
And that is the cause of these problems. The call to prepare_one_comp_unit
needs to be the *first* thing that is done when reading a CU so that the
CU's language can be recorded (and inherited by any referenced
partial_units).
Since a test reproducer for this has been so elusive, this patch also adds a
wrapper function around add_symbol_to_list which asserts when adding a
symbol of one language to a list containing symbols of a different language.
gdb/ChangeLog:
2017-07-24 Keith Seitz <keiths@redhat.com>
PR symtab/23010
* dwarf2read.c (dw2_add_symbol_to_list): New function.
(fixup_go_packaging, new_symbol): Use dw2_add_symbol_to_list
instead of add_symbol_to_list.
(read_file_scope): Call prepare_one_comp_unit before reading
any other DIEs.
configure checks for declarations of free, malloc, and realloc; but
the results are only used in a single spot: utils.c. I think these
checks are long since obsolete, so this patch removes them.
Grepping the entire tree for these HAVE_DECL_ symbols, the only uses
of possible interest to gdb come from bfd/sysdep.h; but this is not
(nor should be) included by gdb. (And furthermore I think the code
there is probably also obsolete.)
gdb/ChangeLog
2018-07-24 Tom Tromey <tom@tromey.com>
* utils.c (malloc, realloc, free): Don't declare.
* configure, config.in: Rebuild.
* configure.ac: Don't check for declarations of free, malloc, or
realloc.
This adds -Wunused-variable to the build. This required a special
check in configure in order to work around a bug in GCC 4.9. Simon
ound the correct test to use, so I've added him to the ChangeLog.
gdb/ChangeLog
2018-07-22 Simon Marchi <simon.marchi@polymtl.ca>
Tom Tromey <tom@tromey.com>
* warning.m4 (AM_GDB_WARNINGS): Add -Wunused-variable and special
test for it.
* configure: Rebuild.
gdb/gdbserver/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
This changes regdat.sh to emit the xmltarget_${name} variable inside
the #ifndef IN_PROCESS_AGENT block. This avoids a -Wunused-variable
warning for some builds. Thanks to Pedro for investigating this one.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* regformats/regdat.sh: Define xmltarget_${name} inside
#ifndef IN_PROCESS_AGENT.
This removes a few unused variables from gdbserver.
The x86-tdesc.h change is a bit unusual for this series. This file
was not defining the multiple-include guard symbol, so I've added that
here. Also, it is hard to determine when i386_expedite_regs will be
needed, so this patch simply marks it ATTRIBUTE_UNUSED.
gdb/gdbserver/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* win32-low.c (win32_create_inferior): Remove unused variables.
* gdbreplay.c (remote_open): Remove unused variable.
* remote-utils.c (remote_prepare): Remove unused variable.
* x86-tdesc.h (X86_TDESC_H): Define.
(amd64_expedite_regs): Define conditionally.
(i386_expedite_regs): Mark ATTRIBUTE_UNUSED.
* linux-x86-tdesc.c (i386_tdescs): Move inside #if.
* remote-utils.c (readchar): Remove unused variable.
This removes an unused declaration from value_fetch_lazy_bitfield.
Because it is not completely clear if the check_typedef call is needed
somewhere beneath this function, this is broken out into a separate
patch.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* value.c (value_fetch_lazy_bitfield): Remove unused variable.
This is actually a patch I found via another route. Joel had asked me
to write a test, but I still have not found the time to do this.
Meanwhile, -Wunused-variable also found this error.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* symfile.c (reread_symbols): Notify iter, not objfile.
The change to turn target ops into methods accidentally introduced a
bug in ravenscar-thread.c, changing some calls that were using
"arch_ops" to use the target beneath.
This patch changes ravenscar-thread.c to use these variables where
appropriate.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* ravenscar-thread.c (ravenscar_thread_target::store_registers):
Use arch_ops.
(ravenscar_thread_target::prepare_to_store): Likewise.
This removes some unused variables, and replaces the calls to
value_contents_for_printing with a call to value_fetch_lazy, when
needed.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* python/py-prettyprint.c (gdbpy_apply_val_pretty_printer): Remove
unused variable. Call value_fetch_lazy when needed.
* guile/scm-pretty-print.c (gdbscm_apply_val_pretty_printer):
Remove unused variable. Call value_fetch_lazy when needed.
This removes some unused declarations from m32c-tdep.c. Initially I
had thought that this entire code block was dead, but Simon pointed
out that it is not; so this patch simply removes some declarations.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* m32c-tdep.c (mark_dma): Return void.
(make_regs): Remove unused declarations.
This changes a couple of spots in guile/ to remove a variable
declaration but to still call a function for effect.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* guile/scm-cmd.c (gdbscm_dont_repeat): Call
cmdscm_get_valid_command_smob_arg_unsafe for effect.
* guile/scm-block.c (gdbscm_make_block_syms_iter): Call
bkscm_get_valid_block_smob_arg_unsafe for effect.
This changes bfin_push_dummy_call to use the result of check_typedef.
Calling check_typedef for effect was probably ok as well, but this
seemed a little nicer.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* bfin-tdep.c (bfin_push_dummy_call): Use arg_type, not
value_type.
This patch fixes various unused variable warnings that are related to
conditional compilation. In these cases, either the variable is now
protected by the same #if as its uses, or the declaration is simply
lowered into the conditionally-compiled block.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* windows-nat.c (saved_context): Conditionally define.
* remote.c (remote_target::remote_btrace_maybe_reopen):
Conditionally declare "warned".
* inflow.c (sigquit_ours): Conditionally define.
(new_tty): Move "tty" declaration inside #if.
* guile/guile.c (guile_datadir): Conditionally define.
* charset.c (set_be_le_names): Move some declarations inside #if.
* btrace.c (parse_xml_btrace): Move "errcode" declaration inside
#if.
(parse_xml_btrace_conf): Likewise.
This removes an unused variable from spu_get_overlay_table, replacing
it with an explanatory comment.
gdb/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* spu-tdep.c (spu_get_overlay_table): Remove unused variable.
Some variables are not used when !HAVE_ELF, so avoid declaring them in
that case.
gdb/ChangeLog:
* arm-tdep.c (arm_gdbarch_init): Declare attr_arch and
attr_profile in HAVE_ELF.
* rs6000-tdep.c (bfd_uses_spe_extensions): Declare vector_abi in
HAVE_ELF.
I am currently working with these functions, and though this renaming
could help to reason about the code. Some functions take a frame and
will return the value associated to that frame, others will return the
value associated to the previous frame. Those usually conveniently
contain "unwind" in their name, but naming the variable next_frame
instead of frame helps remembering which frame we are dealing with.
I also included a little typo fix at the top of frame.h.
gdb/ChangeLog:
* frame.c (frame_register_unwind): Change parameter name.
(frame_unwind_register): Likewise.
(frame_unwind_register_value): Likewise.
(frame_unwind_register_signed): Likewise.
(frame_unwind_register_unsigned): Likewise.
* frame.h (frame_register_unwind): Likewise.
(frame_unwind_register): Likewise.
(frame_unwind_register_value): Likewise.
(frame_unwind_register_signed): Likewise.
(frame_unwind_register_unsigned): Likewise.
(frame_unwind_arch): Likewise.
binutils/
* MAINTAINERS: Update my e-mail address, downgrade to MIPS I-IV
ISA maintenance.
gdb/
* MAINTAINERS: Update my e-mail address, downgrade to MIPS I-IV
ISA maintenance.
sim/
* MAINTAINERS: Update my e-mail address, downgrade to MIPS I-IV
ISA maintenance.
Use `get_ptrace_pid' to get the ptrace PID from `inferior_ptid' rather
than extracting it by hand.
gdb/
* mips-linux-nat.c (mips_linux_nat_target::read_description):
Call `get_ptrace_pid' rather than extracting the ptrace PID by
hand.
This renames all the remaining members of buildsym_compunit to start
with "m_" to follow the general naming convention.
gdb/ChangeLog
2018-07-20 Keith Seitz <keiths@redhat.com>
* buildsym.h (struct buildsym_compunit) <m_objfile, m_subfiles,
m_main_subfile, m_comp_dir, m_producer, m_debugformat,
m_compunit_symtab, m_language>: Add "m_" prefix.
Update all uses.
* buildsym.c: Update all uses.
The record_line_ftype typedef was only used in the DWARF reader, and
we removed those uses a few patches ago. So, remove the typedef.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* buildsym-legacy.h (record_line): Don't use record_line_ftype.
* buildsym.h (record_line_ftype): Remove typedef.
Now that the DWARF reader uses the builder-based API, we can remove a
few "legacy" functions that were only ever called by it.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* buildsym-legacy.h (augment_type_symtab): Don't declare.
(end_expandable_symtab): Likewise.
(end_symtab_get_static_block): Likewise.
(end_symtab_from_static_block): Likewise.
* buildsym-legacy.c (augment_type_symtab): Remove.
(end_expandable_symtab): Remove.
(end_symtab_get_static_block): Remove.
(end_symtab_from_static_block): Remove.
This converts the DWARF reader to use the new-style buildsym API. A
new buildsym_compunit is created for each CU and is used to construct
the symbol table. In some cases the CU must be passed to functions
which previously did not accept it. FWIW I tend to think that most
methods in the DWARF reader ought to be methods on the dwarf2_cu
object.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* dwarf2read.c: Include buildsym.h.
(struct dwarf2_cu) <builder>: New method.
(fixup_go_packaging): Update.
(process_full_comp_unit, process_full_type_unit): Update. Don't
use scoped_free_pendings.
(using_directives): Add "cu" parameter, remove "language".
(read_import_statement, setup_type_unit_groups, )
(read_func_scope, read_lexical_block_scope)
(dwarf2_record_block_ranges, read_namespace): Update.
(lnp_state_machine::lnp_state_machine): Add cu parameter.
(lnp_state_machine::handle_end_sequence): Update.
(class lnp_state_machine) <m_cu>: New member.
<m_record_line_callback>: Remove.
<m_currently_recording_lines>: New member.
(lnp_state_machine::handle_set_file): Update.
(noop_record_line): Remove.
(dwarf_record_line_p): Add cu parameter.
(dwarf_record_line_1, dwarf_finish_line): Likewise.
(lnp_state_machine::record_line)
(lnp_state_machine::lnp_state_machine)
(lnp_state_machine::check_line_address, dwarf_decode_lines_1)
(dwarf_decode_lines): Update.
(dwarf2_start_subfile): Add cu parameter.
(dwarf2_start_symtab, new_symbol): Update.
(macro_start_file, dwarf_decode_macro_bytes): Add cu parameter.
Remove dwarf2_per_objfile parameter.
(dwarf_decode_macros): Update.