Alan Modra [Tue, 11 Sep 2018 14:20:15 +0000 (23:50 +0930)]
PR23425, unresolved symbol diagnostic
dwarf2.c code reasonably assumes that debug info is local to a file,
an assumption now violated by gcc, resulting in "DWARF error: invalid
abstract instance DIE ref" or wrong details when attempting to print
linker error messages with file, function and line reported.
This is because find_abstract_instance is only prepared to handle
DW_FORM_ref_addr when the .debug_info section referenced is in the
current file. When that isn't the case, relocations to access another
file's .debug_info will typically be against a symbol defined at the
start of that .debug_info section, plus an addend. Since the dwarf2.c
code only considers the current file's debug info, that symbol will be
undefined, resolving to zero. In effect the ref_addr will wrongly
resolve to the current file's .debug_info.
This patch avoids the problem by treating relocations in debug
sections against undefined symbols in a similar manner to the way
relocations against symbols defined in discarded sections are
resolved. They result in a zero value (except in .debug_ranges)
regardless of the addend.
PR 23425
* reloc.c (bfd_generic_get_relocated_section_contents): Zero reloc
fields in debug sections when reloc is against an undefined symbol
and called from bfd_simple_get_relocated_section_contents or
similar.
* dwarf2.c (find_abstract_instance): Return true for zero offset
DW_FORM_ref_addr without returning values.
Jan Beulich [Fri, 14 Sep 2018 09:21:15 +0000 (11:21 +0200)]
x86: fold CRC32 templates
Just like other insns having byte and word forms, these can also make
use of the W modifier, which at the same time allows simplifying some
other code a little bit.
Alan Hayward [Wed, 5 Sep 2018 09:11:32 +0000 (10:11 +0100)]
Testsuite: Add gdb_simple_compile
Simplfy gdb.exp by adding a function that will attempt to
compile a piece of code, then clean up, leaving the created
object.
gdb/testsuite
* lib/gdb.exp (gdb_simple_compile): Add proc.
(is_elf_target): Use gdb_simple_compile.
(skip_altivec_tests): Likewise.
(skip_vsx_tests): Likewise.
(skip_tsx_tests): Likewise.
(skip_btrace_tests): Likewise.
(skip_btrace_pt_tests): Likewise.
(gdb_can_simple_compile): Likewise.
(gdb_has_argv0): Likewise.
(gdb_target_symbol_prefix): Likewise.
(target_supports_scheduler_locking): Likewise.
GDB Administrator [Fri, 14 Sep 2018 00:00:32 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Thu, 13 Sep 2018 22:30:48 +0000 (16:30 -0600)]
Generate more tags in gdb/testsuite/Makefile
I noticed that the TAGS target in gdb/testsuite/Makefile does not pick
up Tcl procs defined with proc_with_prefix or gdb_caching_proc. This
patch fixes this by updating the regexp.
Tested in Emacs.
gdb/testsuite/ChangeLog
2018-09-13 Tom Tromey <tom@tromey.com>
* Makefile.in (TAGS): Recognize proc_with_prefix and
gdb_caching_proc.
Tom Tromey [Thu, 13 Sep 2018 22:23:52 +0000 (16:23 -0600)]
Make infpy_thread_from_thread_handle static
I noticed that infpy_thread_from_thread_handle is not static, but
should be. This patch changes it.
gdb/ChangeLog
2018-09-13 Tom Tromey <tom@tromey.com>
* python/py-inferior.c (infpy_thread_from_thread_handle): Now
static.
Tom Tromey [Thu, 30 Aug 2018 05:05:54 +0000 (23:05 -0600)]
Remove cleanup from try_open_exec_file
This removes a cleanup from try_open_exec_file, using std::string to
manage the storage instead.
gdb/ChangeLog
2018-09-13 Tom Tromey <tom@tromey.com>
* exec.c (try_open_exec_file): Use std::string.
Tom Tromey [Thu, 30 Aug 2018 05:03:09 +0000 (23:03 -0600)]
Return std::string from gdb_bfd_errmsg
This changes gdb_bfd_errmsg to return a std::string, removing a
cleanup. This approach may be slightly less efficient than the
previous code, but I don't believe this is very important in this
situation.
gdb/ChangeLog
2018-09-13 Tom Tromey <tom@tromey.com>
* utils.h (gdb_bfd_errmsg): Return std::string.
* exec.c (exec_file_attach): Update.
* compile/compile-object-load.c (compile_object_load): Update.
* utils.c (gdb_bfd_errmsg): Return std::string.
Tom Tromey [Thu, 30 Aug 2018 04:49:40 +0000 (22:49 -0600)]
Remove cleanup from procfs.c
This removes the last remaining cleanup from procfs.c, replacing it
with a unique_ptr specialization.
gdb/ChangeLog
2018-09-13 Tom Tromey <tom@tromey.com>
* procfs.c (struct procinfo_deleter): New.
(procinfo_up): New typedef.
(do_destroy_procinfo_cleanup): Remove.
(procfs_target::info_proc): Use procinfo_up. Remove cleanups.
Tom Tromey [Thu, 30 Aug 2018 04:42:57 +0000 (22:42 -0600)]
Remove cleanup from add_path
This removes a cleanup from add_path, replacing it with a use of
gdb::unique_xmalloc_ptr. Note that this declaration had to be hoisted
somewhat, to avoid inteference from the "goto"s in this function.
gdb/ChangeLog
2018-09-13 Tom Tromey <tom@tromey.com>
* source.c (add_path): Use gdb::unique_xmalloc_ptr.
Simon Marchi [Thu, 13 Sep 2018 19:41:32 +0000 (15:41 -0400)]
python: Fix erroneous doc about gdb.objfiles()
The code implementing gdb.objfiles() returns a list of objfiles for the
current program space (the program space of the selected inferior). The
documentation for the gdb.objfiles() Python method, however, states:
Return a sequence of all the objfiles current known to GDB.
That sounds wrong to me. I tried to phrase to be more precise.
gdb/doc/ChangeLog:
* python.texi (Objfiles In Python): Update gdb.objfiles() doc.
Simon Marchi [Thu, 13 Sep 2018 19:40:41 +0000 (15:40 -0400)]
python: Add Progspace.objfiles method
This patch adds an objfiles method to the Progspace object, which
returns a sequence of the objfiles associated to that program space. I
chose a method rather than a property for symmetry with gdb.objfiles().
gdb/ChangeLog:
* python/py-progspace.c (PSPY_REQUIRE_VALID): New macro.
(pspy_get_objfiles): New function.
(progspace_object_methods): New.
(pspace_object_type): Add tp_methods callback.
* python/python-internal.h (build_objfiles_list): New
declaration.
* python/python.c (build_objfiles_list): New function.
(gdbpy_objfiles): Implement using build_objfiles_list.
* NEWS: Mention the Progspace.objfiles method.
gdb/doc/ChangeLog:
* python.texi (Program Spaces In Python): Document the
Progspace.objfiles method.
(Objfiles In Python): Mention that gdb.objfiles() is identical
to gdb.selected_inferior().progspace.objfiles().
gdb/testsuite/ChangeLog:
* gdb.python/py-progspace.exp: Test the Progspace.objfiles
method.
Simon Marchi [Thu, 13 Sep 2018 19:39:26 +0000 (15:39 -0400)]
python: Add Inferior.progspace property
This patch adds a progspace property to the gdb.Inferior type, which
allows getting the gdb.Progspace object associated to that inferior.
In conjunction with the following patch, this will allow scripts iterate
on objfiles associated with a particular inferior.
gdb/ChangeLog:
* python/py-inferior.c (infpy_get_progspace): New function.
(inferior_object_getset): Add progspace property.
* NEWS: Mention the new property.
gdb/doc/ChangeLog:
* python.texi (Inferiors In Python): Document
Inferior.progspace.
(Program Spaces In Python): Document that
gdb.current_progspace() is the same as
gdb.selected_inferior().progspace.
gdb/testsuite/ChangeLog:
* gdb.python/py-inferior.exp: Add tests for Inferior.progspace
and a few other Inferior properties when the Inferior is no
longer valid.
Tom Tromey [Thu, 13 Sep 2018 16:56:34 +0000 (10:56 -0600)]
Make Rust error message mention the field name
I noticed a spot in rust-lang.c where the placeholder "foo" was used
instead of the actual field name. This patch fixes the bug.
gdb/ChangeLog
2018-09-13 Tom Tromey <tom@tromey.com>
PR rust/23650:
* rust-lang.c (rust_evaluate_subexp): Use field name, not "foo".
gdb/testsuite/ChangeLog
2018-09-13 Tom Tromey <tom@tromey.com>
PR rust/23650:
* gdb.rust/simple.exp: Add test for enum field access error.
Tom Tromey [Tue, 11 Sep 2018 21:28:04 +0000 (15:28 -0600)]
Fix crash with empty Rust enum
While testing my Rust compiler patch to fix the DWARF representation
of Rust enums (https://github.com/rust-lang/rust/pull/54004), I found
a gdb crash coming from one of the Rust test cases.
The bug here is that the new variant support in gdb does not handle
the case where there are no variants in the enum.
This patch fixes the problem in a straightforward way. Note that the
new tests are somewhat lax because I did not want to try to fully fix
this corner case for older compilers. If you think that's
unacceptable, let meknow.
Tested on x86-64 Fedora 28 using several versions of the Rust
compiler. I intend to push this to the 8.2 branch as well.
gdb/ChangeLog
2018-09-13 Tom Tromey <tom@tromey.com>
PR rust/23626:
* rust-lang.c (rust_enum_variant): Now static.
(rust_empty_enum_p): New function.
(rust_print_enum, rust_evaluate_subexp, rust_print_struct_def):
Handle empty enum.
gdb/testsuite/ChangeLog
2018-09-13 Tom Tromey <tom@tromey.com>
PR rust/23626:
* gdb.rust/simple.rs (EmptyEnum): New type.
(main): Use it.
* gdb.rust/simple.exp (test_one_slice): Add empty enum test.
Sergio Durigan Junior [Wed, 12 Sep 2018 05:14:31 +0000 (01:14 -0400)]
Add "contrib" to the list of GDB support dirs (on src-release.sh)
On commit:
commit
5a6996172e6294ea37054b1a9caa3a923a8fe399
Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date: Mon Aug 6 16:05:16 2018 +0200
Update dg-extract-results.* from gcc
dg-extract-results.sh was moved from the "gdb/contrib/" directory to
the toplevel "contrib/" directory. However, src-release.sh was not
updated in order to include "contrib/" in the tarball release of GDB.
This makes it very inconvenient to run and analyze the GDB testsuite
results. This commit adds "contrib/" to the list of support
directories that are included in each GDB release.
ChangeLog:
2018-09-12 Sergio Durigan Junior <sergiodj@redhat.com>
* src-release.sh (GDB_SUPPORT_DIRS): Add "contrib".
H.J. Lu [Thu, 13 Sep 2018 16:09:00 +0000 (09:09 -0700)]
Add a testcase for PR binutils/23633
PR binutils/23633
* testsuite/binutils-all/objcopy.exp: Run pr23633.
* testsuite/binutils-all/pr23633.d: New file.
* testsuite/binutils-all/pr23633.list: Likewise.
* testsuite/binutils-all/pr23633.s: Likewise.
Simon Marchi [Thu, 13 Sep 2018 15:53:22 +0000 (11:53 -0400)]
python: Provide textual representation for Inferior and Objfile
Printing a GDB Python object is notoriously not helpful:
>>> print(gdb.selected_inferior())
<gdb.Inferior object at 0x7fea59aed198>
>>> print(gdb.objfiles())
[<gdb.Objfile object at 0x7fea59b57c90>]
This makes printing debug traces more difficult than it should be. This
patch provides some repr() implementation for these two types (more to
come if people agree with the idea, but I want to test the water first).
Here's the same example as above, but with this patch:
>>> print(gdb.selected_inferior())
<gdb.Inferior num=1>
>>> print(gdb.objfiles())
[<gdb.Objfile filename=/home/emaisin/build/binutils-gdb-gcc-git/gdb/test>]
I implemented repr rather than str, because when printing a list (or
another container I suppose), Python calls the repr method of the
elements. This is useful when printing a list of inferiors or objfiles.
The print(gdb.objfiles()) above would not have worked if I had
implemented str.
I found this post useful to understand the difference between repr and
str:
https://stackoverflow.com/questions/
1436703/difference-between-str-and-repr
gdb/ChangeLog:
* python/py-inferior.c (infpy_repr): New.
(inferior_object_type): Register infpy_repr.
* python/py-objfile.c (objfpy_repr): New.
(objfile_object_type): Register objfpy_repr.
gdb/testsuite/ChangeLog:
* gdb.python/py-inferior.exp: Test repr() of gdb.Inferior.
* gdb.python/py-objfile.exp: Test repr() of gdb.Objfile.
* gdb.python/py-symtab.exp: Update test printing an objfile.
gdb/doc/ChangeLog:
* python.texi (Basic Python): Mention the string representation
of GDB Python objects.
Nick Clifton [Thu, 13 Sep 2018 15:14:36 +0000 (16:14 +0100)]
Fix a use-after-freed error introduced by previous attempt to fix a Coverity scan result.
PR 23633
* objcopy.c (add_specific_symbols): Do not free the buffer at the
end of the function.
H.J. Lu [Thu, 13 Sep 2018 14:38:45 +0000 (07:38 -0700)]
x86: Remove VexW=1 from WIG VEX movq and vmovq
Put back changes lost in commit
41d1ab6a6d96937fd0db04e53746f93f53687807.
H.J. Lu [Wed, 12 Sep 2018 22:12:59 +0000 (15:12 -0700)]
i386: Update VexW field for VEX instructions
1. Mark VEX.W0 VEX instructions with VexW=1.
2. Mark VEX.W1 VEX instructions with VexW=2.
3. Remove VexW=1 from WIG VEX instructions.
* i386-opc.tbl: Add VexW=1 to VEX.W0 VEX movd, cvtsi2ss, cvtsi2sd,
pextrd, pinsrd, vcvtsi2sd, vcvtsi2ss, vmovd, vpextrd and vpinsrd.
Add VexW=2 to VEX.W1 VEX movd, movq, pextrq, pinsrq, vmod, vmovq,
vpextrq and vpinsrq. Remove VexW=1 from WIG VEX movq and vmovq.
* i386-tbl.h: Regenerated.
H.J. Lu [Thu, 13 Sep 2018 13:12:31 +0000 (06:12 -0700)]
x86: Swap destination/source to encode VEX only if possible
When encoding VEX, we can swap destination and source only if there are
more than 1 register operand.
* config/tc-i386.c (build_vex_prefix): Swap destination and
source only if there are more than 1 register operand.
Jan Beulich [Thu, 13 Sep 2018 09:26:06 +0000 (11:26 +0200)]
x86: drop bogus IgnoreSize from a few further insns
Jan Beulich [Thu, 13 Sep 2018 09:25:30 +0000 (11:25 +0200)]
x86: drop bogus IgnoreSize from AVX512_4* insns
Jan Beulich [Thu, 13 Sep 2018 09:24:53 +0000 (11:24 +0200)]
x86: drop bogus IgnoreSize from AVX512DQ insns
Jan Beulich [Thu, 13 Sep 2018 09:24:23 +0000 (11:24 +0200)]
x86: drop bogus IgnoreSize from AVX512BW insns
Jan Beulich [Thu, 13 Sep 2018 09:23:50 +0000 (11:23 +0200)]
x86: drop bogus IgnoreSize from AVX512VL insns
Jan Beulich [Thu, 13 Sep 2018 09:23:17 +0000 (11:23 +0200)]
x86: drop bogus IgnoreSize from AVX512ER insns
Jan Beulich [Thu, 13 Sep 2018 09:22:49 +0000 (11:22 +0200)]
x86: drop bogus IgnoreSize from AVX512F insns
Jan Beulich [Thu, 13 Sep 2018 09:22:03 +0000 (11:22 +0200)]
x86: drop bogus IgnoreSize from SHA insns
Jan Beulich [Thu, 13 Sep 2018 09:21:36 +0000 (11:21 +0200)]
x86: drop bogus IgnoreSize from XOP and SSE4a insns
Jan Beulich [Thu, 13 Sep 2018 09:19:21 +0000 (11:19 +0200)]
x86: drop bogus IgnoreSize from AVX2 insns
Jan Beulich [Thu, 13 Sep 2018 09:18:52 +0000 (11:18 +0200)]
x86: drop bogus IgnoreSize from AVX insns
Jan Beulich [Thu, 13 Sep 2018 09:16:49 +0000 (11:16 +0200)]
x86: drop bogus IgnoreSize from GNFI insns
Jan Beulich [Thu, 13 Sep 2018 09:16:19 +0000 (11:16 +0200)]
x86: drop bogus IgnoreSize from PCLMUL/VPCLMUL insns
Jan Beulich [Thu, 13 Sep 2018 09:15:38 +0000 (11:15 +0200)]
x86: drop bogus IgnoreSize from AES/VAES insns
Jan Beulich [Thu, 13 Sep 2018 09:15:01 +0000 (11:15 +0200)]
x86: drop bogus IgnoreSize from SSE4.2 insns
Jan Beulich [Thu, 13 Sep 2018 09:14:32 +0000 (11:14 +0200)]
x86: drop bogus IgnoreSize from SSE4.1 insns
Jan Beulich [Thu, 13 Sep 2018 09:12:51 +0000 (11:12 +0200)]
x86: drop bogus IgnoreSize from SSSE3 insns
Jan Beulich [Thu, 13 Sep 2018 09:12:23 +0000 (11:12 +0200)]
x86: drop bogus IgnoreSize from SSE3 insns
Jan Beulich [Thu, 13 Sep 2018 09:11:55 +0000 (11:11 +0200)]
x86: drop bogus IgnoreSize from SSE2 insns
Jan Beulich [Thu, 13 Sep 2018 09:11:26 +0000 (11:11 +0200)]
x86: drop bogus IgnoreSize from SSE insns
Jan Beulich [Thu, 13 Sep 2018 09:08:37 +0000 (11:08 +0200)]
x86: drop unnecessary {,No}Rex64
Jan Beulich [Thu, 13 Sep 2018 09:07:55 +0000 (11:07 +0200)]
x86: also allow D on 3-operand insns
For now this is just for VMOVS{D,S}.
Jan Beulich [Thu, 13 Sep 2018 09:07:07 +0000 (11:07 +0200)]
x86: use D attribute also for SIMD templates
Various moves come in load and store forms, and just like on the GPR
and FPU sides there would better be only one pattern. In some cases this
is not feasible because the opcodes are too different, but quite a few
cases follow a similar standard scheme. Introduce Opcode_SIMD_FloatD and
Opcode_SIMD_IntD, generalize handling in operand_size_match() (reverse
operand handling there simply needs to match "straight" operand one),
and fix a long standing, but so far only latent bug with when to zap
found_reverse_match.
Also once again drop IgnoreSize where pointlessly applied to templates
touched anyway as well as *word when redundant with Reg*.
Jan Beulich [Thu, 13 Sep 2018 09:06:07 +0000 (11:06 +0200)]
x86: fold ILP32 output of "opts" tests
The output is identical to that of the LP64 tests. No need to fully
spell this out twice.
Jan Beulich [Thu, 13 Sep 2018 09:05:27 +0000 (11:05 +0200)]
x86: improve operand reversal
In quite a few cases the .s suffix or {load} / {store} prefixes did not
work as intended, or produced errors when they're supposed to be ignored
when it is not possible to carry out the request.
The change here re-purposes(?) the .s suffix to no longer mean "store"
(if that's what 's' did stand for), since the forms used in the base
templates are not consistently loads (and we unlikely want to change
that). The pseudo prefixes will now fulfill what their names say, i.e.
{load} now only ever produces a load form encoding (if available) while
{store} only ever produces a store form one (again if available). This
requires minimal test suite adjustments, while the majority of the
changes there are simply additions.
Jan Beulich [Thu, 13 Sep 2018 09:04:38 +0000 (11:04 +0200)]
x86: add code comment on deprecated status of pseudo-suffixes
Jan Beulich [Thu, 13 Sep 2018 09:03:35 +0000 (11:03 +0200)]
x86-64: bndmk, bndldx, and bndstx don't allow RIP-relative addressing
Nick Clifton [Thu, 13 Sep 2018 08:34:53 +0000 (09:34 +0100)]
Fix the use by the RL78 assembler of an uninitialised field in the expresion structure.
* dwarf2dbg.c (generic_dwarf2_emit_offset): Use memset to
initialise expression structure.
(set_or_check_view): Likewise.
(out_set_addr): Likewise.
(emit_fixed_inc_line_addr): Likewise.
(relax_inc_line_addr): Likewise.
(out_debug_line): Likewise.
(out_debug_ranges): Likewise.
(out_debug_aranges): Likewise.
(out_debug_info): Likewise.
GDB Administrator [Thu, 13 Sep 2018 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
John Baldwin [Wed, 12 Sep 2018 17:43:13 +0000 (17:43 +0000)]
Remove unused "tmp" variable.
gdb/ChangeLog:
* fbsd-nat.c (fbsd_nat_target::info_proc): Remove unused variable.
John Baldwin [Tue, 11 Sep 2018 17:53:37 +0000 (17:53 +0000)]
Fix a typo in a comment.
gdb/ChangeLog:
* aarch64-fbsd-tdep.h (AARCH64_FBSD_SIZEOF_GREGSET): Fix comment
typo.
Simon Marchi [Wed, 12 Sep 2018 22:27:57 +0000 (18:27 -0400)]
python: Add tests for trying to use an invalid Inferior object
This patch adds tests for trying to use property or methods on a
gdb.Inferior object that represents an inferior that does not exist
anymore. We expect an exception to be thrown.
gdb/testsuite/ChangeLog:
* gdb.python/py-inferior.exp: Test using an invalid gdb.Inferior
object.
Sergio Durigan Junior [Wed, 12 Sep 2018 17:16:02 +0000 (13:16 -0400)]
Move 'is_regular_file' from common-utils.c to filestuff.c
There is no reason for 'is_regular_file' to be in common-utils.c; it
belongs to 'filestuff.c'. This commit moves the function definition
and its prototype to the appropriate files.
The motivation behind this move is a failure that happens on certain
cross-compilation environments when compiling the IPA library, due to
the way gnulib probes the need for a 'stat' call replacement. Because
configure checks when cross-compiling are more limited, gnulib decides
that it needs to substitute the 'stat' calls its own 'rpl_stat';
however, the IPA library doesn't link with gnulib, which leads to an
error when compiling 'common-utils.c':
...
/opt/x86-core2--musl--bleeding-edge-2018.09-1/bin/i686-buildroot-linux-musl-g++ -shared -fPIC -Wl,--soname=libinproctrace.so -Wl,--no-undefined -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -I. -I. -I./../common -I./../regformats -I./.. -I./../../include -I./../gnulib/import -Ibuild-gnulib-gdbserver/import -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized -DGDBSERVER \
-Wl,--dynamic-list=./proc-service.list -o libinproctrace.so ax-ipa.o common-utils-ipa.o errors-ipa.o format-ipa.o print-utils-ipa.o regcache-ipa.o remote-utils-ipa.o rsp-low-ipa.o tdesc-ipa.o tracepoint-ipa.o utils-ipa.o vec-ipa.o linux-i386-ipa.o linux-x86-tdesc-ipa.o arch/i386-ipa.o -ldl -pthread
/opt/x86-core2--musl--bleeding-edge-2018.09-1/lib/gcc/i686-buildroot-linux-musl/8.2.0/../../../../i686-buildroot-linux-musl/bin/ld: common-utils-ipa.o: in function `is_regular_file(char const*, int*)':
common-utils.c:(.text+0x695): undefined reference to `rpl_stat'
collect2: error: ld returned 1 exit status
Makefile:413: recipe for target 'libinproctrace.so' failed
make[1]: *** [libinproctrace.so] Error 1
...
More details can also be found at:
https://sourceware.org/ml/gdb-patches/2018-09/msg00304.html
The most simple fix for this problem is to move 'is_regular_file' to
'filestuff.c', which is not used by IPA. This ends up making the
files more logically organized as well, since 'is_regular_file' is a
file operation.
No regressions found.
gdb/ChangeLog:
2018-09-12 Sergio Durigan Junior <sergiodj@redhat.com>
* common/common-utils.c: Don't include '<sys/stat.h>'.
(is_regular_file): Move to...
* common/filestuff.c (is_regular_file): ... here.
* common/common-utils.h (is_regular_file): Move to...
* common/filestuff.h (is_regular_file): ... here.
Simon Marchi [Wed, 12 Sep 2018 16:24:41 +0000 (12:24 -0400)]
Add debug output about skipping files and functions
While trying to create skips for libstdc++, I found myself debugging GDB
quite a bit, mostly to find out what the exact function name to match
is. I thought it would make sense to have this information as debug
output.
This patch adds "set debug skip on|off".
gdb/ChangeLog:
* skip.c (debug_skip): New variable.
(skiplist_entry::do_skip_file_p): Add debug output.
(skiplist_entry::do_skip_gfile_p): Likewise.
(skiplist_entry::skip_function_p): Likewise.
(_initialize_step_skip): Create debug command.
* NEWS: Mention set/show debug skip.
gdb/doc/ChangeLog:
* gdb.texinfo (Skipping Over Functions and Files): Document
set/show debug skip.
Alan Hayward [Wed, 12 Sep 2018 10:52:09 +0000 (11:52 +0100)]
Testsuite: Add gdb_can_simple_compile
Simplfy gdb.exp by adding a function that will attempt to
compile a piece of code, then clean up.
gdb/testsuite
* lib/gdb.exp (gdb_can_simple_compile): Add proc.
(support_complex_tests): Use gdb_can_simple_compile.
(is_ilp32_target): Likewise.
(is_lp64_target): Likewise.
(is_64_target): Likewise.
(is_amd64_regs_target): Likewise.
(is_aarch32_target): Likewise.
(gdb_int128_helper): Likewise.
GDB Administrator [Wed, 12 Sep 2018 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in
Xavier Roirand [Sat, 8 Sep 2018 14:51:21 +0000 (16:51 +0200)]
Darwin: set startup-with-shell to off on Sierra and later.
On Mac OS X Sierra and later, the shell is not allowed to be
debug so add a check and disable startup with shell in that
case. This disabling is done temporary before forking
inferior and restored after the fork.
gdb/ChangeLog:
* darwin-nat.c (should_disable_startup_with_shell):
New function.
(darwin_nat_target::create_inferior): Add call.
Change-Id: Ie4d9090f65fdf2e83ecf7a0f9d0647fb1c27cdcc
Xavier Roirand [Sun, 9 Sep 2018 13:13:58 +0000 (15:13 +0200)]
Darwin: fix SIGTRAP when debugging
Debugging a program under Darwin does not work:
(gdb) start
Temporary breakpoint 1 at 0x100000fb4: file /tmp/helloworld.c, line 1.
Starting program: /private/tmp/helloworld
[New Thread 0x2903 of process 60326]
During startup program terminated with signal SIGTRAP, Trace/breakpoint
trap.
Field signaled from darwin_thread_info is not initialized thus signal
sent to the debuggee is considered as not sent by GDB whereas it should.
This patch fixes this problem and also updates (change type and/or
initialize) other fields in the same structure at the same time.
gdb/ChangeLog:
* darwin-nat.h (struct darwin_thread_info) <gdb_port,
inf_port, msg_state>: Initialize.
(struct darwin_thread_info) <signaled, single_step>: Change
type and initialize.
(struct darwin_thread_info) <event>: Initialize.
Change-Id: I0fe2a6985df9d0dfcc8a2a258a3ef70cfa19b403
Jan Kratochvil [Tue, 11 Sep 2018 10:59:52 +0000 (12:59 +0200)]
[testsuite] Fix dg-extract-results.sh path
There was a typo in patch:
commit
5a6996172e6294ea37054b1a9caa3a923a8fe399
Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date: Mon Aug 6 16:05:16 2018 +0200
Update dg-extract-results.* from gcc
gdb/testsuite/ChangeLog
2018-09-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* Makefile.in (check-parallel-racy): Fix dg-extract-results.sh path.
GDB Administrator [Tue, 11 Sep 2018 00:00:52 +0000 (00:00 +0000)]
Automatic date update in version.in
Sergio Durigan Junior [Mon, 10 Sep 2018 16:52:04 +0000 (12:52 -0400)]
Fix PR gdb/23558: Use system's 'getcwd' when cross-compiling GDB
This is a backport of a gnulib fix for the following bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=23558
The problem reported there is about the replacement of 'getcwd' when
cross-compiling GDB. With our current gnulib copy, the mechanism for
deciding whether to use the system's 'getcwd' or gnulib's version is
too simplistic and pessimistic, so when cross-compiling we always end
up using gnulib's version, which has a limitation: it cannot handle
the situation when the parent directory doesn't have read permissions.
The solution is to backport the following gnulib commit:
commit
a96d2e67052c879b1bcc5bc461722beac75fc372
Author: Bruno Haible <bruno@clisp.org>
Date: Thu Aug 23 21:13:19 2018 +0200
getcwd: Add cross-compilation guesses.
gdb/ChangeLog:
2018-09-10 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/23555
PR gdb/23558
* gnulib/import/m4/getcwd-path-max.m4: Add cross-compilation
guesses.
Sergio Durigan Junior [Mon, 10 Sep 2018 16:22:59 +0000 (12:22 -0400)]
Revert "Update gnulib to current upstream master"
This reverts commit
7a6dbc2fdb2323c35e981f93236f323e9d7c0b24 ("Update
gnulib to current upstream master"). It is needed because the gnulib
update caused problems with people using old GCC compilers (version
4.8, for example), which support C99 but don't default to using it.
Unfortunately this broke GDB for these users. A more detailed report
of what happened can be found at:
https://lists.gnu.org/archive/html/bug-gnulib/2018-08/msg00157.html
The reason for updating our gnulib copy was to fix PR gdb/23558.
Reverting this patch reintroduces the bug, so in order to fix it I
will submit a subsequent patch which cherry-picks the fix from gnulib.
gdb/ChangeLog:
2018-09-10 Sergio Durigan Junior <sergiodj@redhat.com>
Revert:
2018-08-29 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/23555
PR gdb/23558
* gnulib/aclocal.m4: Regenerate.
* gnulib/config.in: Regenerate.
* gnulib/configure: Regenerate.
* gnulib/import/Makefile.am: Update.
* gnulib/import/Makefile.in: Update.
* gnulib/import/extra/snippet/_Noreturn.h: Rename to...
* gnulib/import/_Noreturn.h: ... this.
* gnulib/import/alloca.in.h: Update.
* gnulib/import/extra/snippet/arg-nonnull.h: Rename to...
* gnulib/import/arg-nonnull.h: ... this.
* gnulib/import/assure.h: Update.
* gnulib/import/at-func.c: Update.
* gnulib/import/basename-lgpl.c: Update.
* gnulib/import/extra/snippet/c++defs.h: Rename to...
* gnulib/import/c++defs.h: ... this.
* gnulib/import/canonicalize-lgpl.c: Update.
* gnulib/import/cdefs.h: Update.
* gnulib/import/chdir-long.c: Update.
* gnulib/import/chdir-long.h: Update.
* gnulib/import/cloexec.c: Update.
* gnulib/import/cloexec.h: Update.
* gnulib/import/close.c: Update.
* gnulib/import/closedir.c: Update.
* gnulib/import/config.charset: Update.
* gnulib/import/dirent-private.h: Update.
* gnulib/import/dirent.in.h: Update.
* gnulib/import/dirfd.c: Update.
* gnulib/import/dirname-lgpl.c: Update.
* gnulib/import/dirname.h: Update.
* gnulib/import/dosname.h: Update.
* gnulib/import/dup-safer-flag.c: Update.
* gnulib/import/dup-safer.c: Update.
* gnulib/import/dup.c: Update.
* gnulib/import/dup2.c: Update.
* gnulib/import/errno.in.h: Update.
* gnulib/import/error.c: Update.
* gnulib/import/error.h: Update.
* gnulib/import/exitfail.c: Update.
* gnulib/import/exitfail.h: Update.
* gnulib/import/extra/update-copyright: Update.
* gnulib/import/fchdir.c: Update.
* gnulib/import/fcntl.c: Update.
* gnulib/import/fcntl.in.h: Update.
* gnulib/import/fd-hook.c: Update.
* gnulib/import/fd-hook.h: Update.
* gnulib/import/fd-safer-flag.c: Update.
* gnulib/import/fd-safer.c: Update.
* gnulib/import/fdopendir.c: Update.
* gnulib/import/filename.h: Update.
* gnulib/import/filenamecat-lgpl.c: Update.
* gnulib/import/filenamecat.h: Update.
* gnulib/import/flexmember.h: Update.
* gnulib/import/float+.h: Update.
* gnulib/import/float.c: Update.
* gnulib/import/float.in.h: Update.
* gnulib/import/fnmatch.c: Update.
* gnulib/import/fnmatch.in.h: Update.
* gnulib/import/fnmatch_loop.c: Update.
* gnulib/import/fpucw.h: Update.
* gnulib/import/frexp.c: Update.
* gnulib/import/frexpl.c: Update.
* gnulib/import/fstat.c: Update.
* gnulib/import/fstatat.c: Update.
* gnulib/import/getcwd-lgpl.c: Update.
* gnulib/import/getcwd.c: Update.
* gnulib/import/getdtablesize.c: Update.
* gnulib/import/getlogin_r.c: Update.
* gnulib/import/getprogname.c: Update.
* gnulib/import/getprogname.h: Update.
* gnulib/import/gettext.h: Update.
* gnulib/import/gettimeofday.c: Update.
* gnulib/import/glob-libc.h: Update.
* gnulib/import/glob.c: Update.
* gnulib/import/glob.in.h: Update.
* gnulib/import/glob_internal.h: Update.
* gnulib/import/glob_pattern_p.c: Update.
* gnulib/import/globfree.c: Update.
* gnulib/import/hard-locale.c: Update.
* gnulib/import/hard-locale.h: Update.
* gnulib/import/intprops.h: Update.
* gnulib/import/inttypes.in.h: Update.
* gnulib/import/isnan.c: Update.
* gnulib/import/isnand-nolibm.h: Update.
* gnulib/import/isnand.c: Update.
* gnulib/import/isnanl-nolibm.h: Update.
* gnulib/import/isnanl.c: Update.
* gnulib/import/itold.c: Update.
* gnulib/import/libc-config.h: Update.
* gnulib/import/limits.in.h: Update.
* gnulib/import/localcharset.c: Update.
* gnulib/import/localcharset.h: Update.
* gnulib/import/localtime-buffer.c: Update.
* gnulib/import/localtime-buffer.h: Update.
* gnulib/import/lstat.c: Update.
* gnulib/import/m4/00gnulib.m4: Update.
* gnulib/import/m4/__inline.m4: Update.
* gnulib/import/m4/absolute-header.m4: Update.
* gnulib/import/m4/alloca.m4: Update.
* gnulib/import/m4/builtin-expect.m4: Update.
* gnulib/import/m4/canonicalize.m4: Update.
* gnulib/import/m4/chdir-long.m4: Update.
* gnulib/import/m4/close.m4: Update.
* gnulib/import/m4/closedir.m4: Update.
* gnulib/import/m4/configmake.m4: Update.
* gnulib/import/m4/d-ino.m4: Update.
* gnulib/import/m4/d-type.m4: Update.
* gnulib/import/m4/dirent_h.m4: Update.
* gnulib/import/m4/dirfd.m4: Update.
* gnulib/import/m4/dirname.m4: Update.
* gnulib/import/m4/double-slash-root.m4: Update.
* gnulib/import/m4/dup.m4: Update.
* gnulib/import/m4/dup2.m4: Update.
* gnulib/import/m4/eealloc.m4: Update.
* gnulib/import/m4/environ.m4: Update.
* gnulib/import/m4/errno_h.m4: Update.
* gnulib/import/m4/error.m4: Update.
* gnulib/import/m4/exponentd.m4: Update.
* gnulib/import/m4/exponentl.m4: Update.
* gnulib/import/m4/extensions.m4: Update.
* gnulib/import/m4/extern-inline.m4: Update.
* gnulib/import/m4/fchdir.m4: Update.
* gnulib/import/m4/fcntl-o.m4: Update.
* gnulib/import/m4/fcntl.m4: Update.
* gnulib/import/m4/fcntl_h.m4: Update.
* gnulib/import/m4/fdopendir.m4: Update.
* gnulib/import/m4/filenamecat.m4: Update.
* gnulib/import/m4/flexmember.m4: Update.
* gnulib/import/m4/float_h.m4: Update.
* gnulib/import/m4/fnmatch.m4: Update.
* gnulib/import/m4/fnmatch_h.m4: Update.
* gnulib/import/m4/fpieee.m4: Update.
* gnulib/import/m4/frexp.m4: Update.
* gnulib/import/m4/frexpl.m4: Update.
* gnulib/import/m4/fstat.m4: Update.
* gnulib/import/m4/fstatat.m4: Update.
* gnulib/import/m4/getcwd-abort-bug.m4: Update.
* gnulib/import/m4/getcwd-path-max.m4: Update.
* gnulib/import/m4/getcwd.m4: Update.
* gnulib/import/m4/getdtablesize.m4: Update.
* gnulib/import/m4/getlogin.m4: Update.
* gnulib/import/m4/getlogin_r.m4: Update.
* gnulib/import/m4/getpagesize.m4: Update.
* gnulib/import/m4/getprogname.m4: Update.
* gnulib/import/m4/gettimeofday.m4: Update.
* gnulib/import/m4/glibc21.m4: Update.
* gnulib/import/m4/glob.m4: Update.
* gnulib/import/m4/glob_h.m4: Update.
* gnulib/import/m4/gnulib-cache.m4: Update.
* gnulib/import/m4/gnulib-common.m4: Update.
* gnulib/import/m4/gnulib-comp.m4: Update.
* gnulib/import/m4/gnulib-tool.m4: Update.
* gnulib/import/m4/hard-locale.m4: Update.
* gnulib/import/m4/include_next.m4: Update.
* gnulib/import/m4/inttypes-pri.m4: Update.
* gnulib/import/m4/inttypes.m4: Update.
* gnulib/import/m4/isnand.m4: Update.
* gnulib/import/m4/isnanl.m4: Update.
* gnulib/import/m4/largefile.m4: Update.
* gnulib/import/m4/limits-h.m4: Update.
* gnulib/import/m4/localcharset.m4: Update.
* gnulib/import/m4/locale-fr.m4: Update.
* gnulib/import/m4/locale-ja.m4: Update.
* gnulib/import/m4/locale-zh.m4: Update.
* gnulib/import/m4/localtime-buffer.m4: Update.
* gnulib/import/m4/longlong.m4: Update.
* gnulib/import/m4/lstat.m4: Update.
* gnulib/import/m4/malloc.m4: Update.
* gnulib/import/m4/malloca.m4: Update.
* gnulib/import/m4/math_h.m4: Update.
* gnulib/import/m4/mbrtowc.m4: Update.
* gnulib/import/m4/mbsinit.m4: Update.
* gnulib/import/m4/mbsrtowcs.m4: Update.
* gnulib/import/m4/mbstate_t.m4: Update.
* gnulib/import/m4/memchr.m4: Update.
* gnulib/import/m4/memmem.m4: Update.
* gnulib/import/m4/mempcpy.m4: Update.
* gnulib/import/m4/memrchr.m4: Update.
* gnulib/import/m4/mkdir.m4: Update.
* gnulib/import/m4/mkstemp.m4: Update.
* gnulib/import/m4/mmap-anon.m4: Update.
* gnulib/import/m4/mode_t.m4: Update.
* gnulib/import/m4/msvc-inval.m4: Update.
* gnulib/import/m4/msvc-nothrow.m4: Update.
* gnulib/import/m4/multiarch.m4: Update.
* gnulib/import/m4/nocrash.m4: Update.
* gnulib/import/m4/off_t.m4: Update.
* gnulib/import/m4/onceonly.m4: Update.
* gnulib/import/m4/open-cloexec.m4: Update.
* gnulib/import/m4/open.m4: Update.
* gnulib/import/m4/openat.m4: Update.
* gnulib/import/m4/opendir.m4: Update.
* gnulib/import/m4/pathmax.m4: Update.
* gnulib/import/m4/rawmemchr.m4: Update.
* gnulib/import/m4/readdir.m4: Update.
* gnulib/import/m4/readlink.m4: Update.
* gnulib/import/m4/realloc.m4: Update.
* gnulib/import/m4/rename.m4: Update.
* gnulib/import/m4/rewinddir.m4: Update.
* gnulib/import/m4/rmdir.m4: Update.
* gnulib/import/m4/save-cwd.m4: Update.
* gnulib/import/m4/secure_getenv.m4: Update.
* gnulib/import/m4/setenv.m4: Update.
* gnulib/import/m4/signal_h.m4: Update.
* gnulib/import/m4/ssize_t.m4: Update.
* gnulib/import/m4/stat-time.m4: Update.
* gnulib/import/m4/stat.m4: Update.
* gnulib/import/m4/std-gnu11.m4: Update.
* gnulib/import/m4/stdbool.m4: Update.
* gnulib/import/m4/stddef_h.m4: Update.
* gnulib/import/m4/stdint.m4: Update.
* gnulib/import/m4/stdio_h.m4: Update.
* gnulib/import/m4/stdlib_h.m4: Update.
* gnulib/import/m4/strchrnul.m4: Update.
* gnulib/import/m4/strdup.m4: Update.
* gnulib/import/m4/strerror.m4: Update.
* gnulib/import/m4/string_h.m4: Update.
* gnulib/import/m4/strstr.m4: Update.
* gnulib/import/m4/strtok_r.m4: Update.
* gnulib/import/m4/sys_socket_h.m4: Update.
* gnulib/import/m4/sys_stat_h.m4: Update.
* gnulib/import/m4/sys_time_h.m4: Update.
* gnulib/import/m4/sys_types_h.m4: Update.
* gnulib/import/m4/tempname.m4: Update.
* gnulib/import/m4/time_h.m4: Update.
* gnulib/import/m4/unistd-safer.m4: Update.
* gnulib/import/m4/unistd_h.m4: Update.
* gnulib/import/m4/warn-on-use.m4: Update.
* gnulib/import/m4/wchar_h.m4: Update.
* gnulib/import/m4/wchar_t.m4: Update.
* gnulib/import/m4/wctype_h.m4: Update.
* gnulib/import/m4/wint_t.m4: Update.
* gnulib/import/malloc.c: Update.
* gnulib/import/malloc/scratch_buffer.h: Update.
* gnulib/import/malloc/scratch_buffer_grow.c: Update.
* gnulib/import/malloc/scratch_buffer_grow_preserve.c: Update.
* gnulib/import/malloc/scratch_buffer_set_array_size.c: Update.
* gnulib/import/malloca.c: Update.
* gnulib/import/malloca.h: Update.
* gnulib/import/malloca.valgrind: Update.
* gnulib/import/math.in.h: Update.
* gnulib/import/mbrtowc.c: Update.
* gnulib/import/mbsinit.c: Update.
* gnulib/import/mbsrtowcs-impl.h: Update.
* gnulib/import/mbsrtowcs-state.c: Update.
* gnulib/import/mbsrtowcs.c: Update.
* gnulib/import/memchr.c: Update.
* gnulib/import/memmem.c: Update.
* gnulib/import/mempcpy.c: Update.
* gnulib/import/memrchr.c: Update.
* gnulib/import/mkdir.c: Update.
* gnulib/import/mkstemp.c: Update.
* gnulib/import/msvc-inval.c: Update.
* gnulib/import/msvc-inval.h: Update.
* gnulib/import/msvc-nothrow.c: Update.
* gnulib/import/msvc-nothrow.h: Update.
* gnulib/import/open.c: Update.
* gnulib/import/openat-die.c: Update.
* gnulib/import/openat-priv.h: Update.
* gnulib/import/openat-proc.c: Update.
* gnulib/import/openat.c: Update.
* gnulib/import/openat.h: Update.
* gnulib/import/opendir.c: Update.
* gnulib/import/pathmax.h: Update.
* gnulib/import/pipe-safer.c: Update.
* gnulib/import/rawmemchr.c: Update.
* gnulib/import/readdir.c: Update.
* gnulib/import/readlink.c: Update.
* gnulib/import/realloc.c: Update.
* gnulib/import/ref-add.sin: Update.
* gnulib/import/ref-del.sin: Update.
* gnulib/import/rename.c: Update.
* gnulib/import/rewinddir.c: Update.
* gnulib/import/rmdir.c: Update.
* gnulib/import/same-inode.h: Update.
* gnulib/import/save-cwd.c: Update.
* gnulib/import/save-cwd.h: Update.
* gnulib/import/scratch_buffer.h: Update.
* gnulib/import/secure_getenv.c: Update.
* gnulib/import/setenv.c: Update.
* gnulib/import/signal.in.h: Update.
* gnulib/import/stat-time.c: Update.
* gnulib/import/stat-time.h: Update.
* gnulib/import/stat-w32.c: Update.
* gnulib/import/stat-w32.h: Update.
* gnulib/import/stat.c: Update.
* gnulib/import/stdbool.in.h: Update.
* gnulib/import/stddef.in.h: Update.
* gnulib/import/stdint.in.h: Update.
* gnulib/import/stdio.in.h: Update.
* gnulib/import/stdlib.in.h: Update.
* gnulib/import/str-two-way.h: Update.
* gnulib/import/strchrnul.c: Update.
* gnulib/import/strdup.c: Update.
* gnulib/import/streq.h: Update.
* gnulib/import/strerror-override.c: Update.
* gnulib/import/strerror-override.h: Update.
* gnulib/import/strerror.c: Update.
* gnulib/import/string.in.h: Update.
* gnulib/import/stripslash.c: Update.
* gnulib/import/strnlen1.c: Update.
* gnulib/import/strnlen1.h: Update.
* gnulib/import/strstr.c: Update.
* gnulib/import/strtok_r.c: Update.
* gnulib/import/sys_stat.in.h: Update.
* gnulib/import/sys_time.in.h: Update.
* gnulib/import/sys_types.in.h: Update.
* gnulib/import/tempname.c: Update.
* gnulib/import/tempname.h: Update.
* gnulib/import/time.in.h: Update.
* gnulib/import/unistd--.h: Update.
* gnulib/import/unistd-safer.h: Update.
* gnulib/import/unistd.in.h: Update.
* gnulib/import/unsetenv.c: Update.
* gnulib/import/verify.h: Update.
* gnulib/import/extra/snippet/warn-on-use.h: Update.
* gnulib/import/wchar.in.h: Update.
* gnulib/import/wctype.in.h: Update.
* gnulib/import/xalloc-oversized.h: Update.
* gnulib/update-gnulib.sh (GNULIB_COMMIT_SHA1): Set to
"
53e2c179f26a890fa6685af4b6c1397ee370433b".
Simon Marchi [Mon, 10 Sep 2018 16:11:01 +0000 (17:11 +0100)]
Remove unused variable in record-btrace.c
old_inferior_ptid is unused, this is caught by a gcc built from git
recently, not sure about previous versions:
/home/emaisin/src/binutils-gdb/gdb/record-btrace.c: In function ‘frame_info* get_thread_current_frame(thread_info*)’:
/home/emaisin/src/binutils-gdb/gdb/record-btrace.c:1974:10: error: unused variable ‘old_inferior_ptid’ [-Werror=unused-variable]
1974 | ptid_t old_inferior_ptid;
| ^~~~~~~~~~~~~~~~~
gdb/ChangeLog:
* record-btrace.c (get_thread_current_frame): Remove
old_inferior_ptid.
Jerome Guitton [Mon, 10 Sep 2018 15:37:52 +0000 (10:37 -0500)]
(Ada) Fix resolving of homonym components in tagged types
ada_value_struct_elt is used when displaying a component (say, 'N') of
a record object (say, 'Obj') of type, say, 't1'. Now if Obj is tagged
(Ada parlance: "tagged types" are what other object-oriented languages
call "classes"), then 'N' may not be visible in the current view and
we need to look for it in its actual type. We do that at the same time
as resolving variable-length fields. This would typically be done by
the following call to ada_value_struct_elt, with the last parameter
check_tag set to 1:
t1 = ada_to_fixed_type (ada_get_base_type (t1), NULL,
address, NULL, 1);
This is the general logic, but recently we introduced a special case
to handle homonyms. Different components may have the same name in a
tagged type. For instance:
type Top_T is tagged record
N : Integer := 1;
end record;
type Middle_T is new Top.Top_T with record
N : Character := 'a';
end record;
Middle_T extends Top_T and both define a (different) component with
the same name ('N'). In such a case, using the actual type of a
Middle_T object would create a confusion, since we would have two
component 'N' in this actual type.
So, to handle homonyms, we convert t1 to the actual type *if
and only if* N cannot be found in the current view. For example, if Obj
has been created as a Middle_T but is seen as a Top_T'Class at our
point of execution, then "print Obj.N" will display the integer field
defined in Top_T's declaration.
Now, even if we find N in the current view, we still have to get a
fixed type: for instance, the record can be unconstrained and we still
need a fixed type to get the proper offset to each field. That is
to say, in this case:
type Dyn_Top_T (Disc : Natural) is tagged record
S : Integer_Array (1 .. Disc) := (others => Disc);
N : Integer := 1;
end record;
type Dyn_Middle_T is new Dyn_Top.Dyn_Top_T with record
N : Character := 'a';
U : Integer := 42;
end record;
If we have an object Obj of type Dyn_Middle_T and we want to display
U, we don't need to build, from its tag, a real type with all its real
fields. In other words, we don't need to add the parent components:
Disc, S, and the integer N. We only need to access U and it is
directly visible in Dyn_Middle_T. So no tag handling. However, we do
need to build a fixed-size type to have the proper offset to U (since
this offset to U depends on the size of Obj.S, which itself is dynamic
and depends on the value of Obj.Disc).
We accidentally lost some of this treatment when we introduced the
resolution of homonyms. This patch re-install this part by uncoupling
the tag resolution from the "fixing" of variable-length components.
This change also slightly simplifies the non-tagged case: in the
non-tagged case, no need to set check_tag to 1, since we already know
that there is no tag.
gdb/ChangeLog:
* ada-lang.c (ada_value_struct_elt): Call ada_to_fixed_type
with check_tag to 1 if and only if the type is tagged and the
component being searched cannot been found in the current
view. Otherwise, always call ada_to_fixed_type with
check_tag to 0.
gdb/testsuite/ChangeLog:
* gdb.ada/same_component_name: Add test for case of tagged record
with variable-length fields.
Xavier Roirand [Mon, 10 Sep 2018 15:35:58 +0000 (10:35 -0500)]
(Ada) Cleanup code by using ada_is_access_to_unconstrained_array call.
This patch just avoids code duplication by using a function we
introduced recently (ada_is_access_to_unconstrained_array).
gdb/ChangeLog:
* ada-lang.c (ada_is_access_to_unconstrained_array): Remove static
declaration.
* ada-lang.h: add ada_is_access_to_unconstrained_array prototype.
* ada-varobj.c (ada_varobj_get_number_of_children,
ada_varobj_describe_child, ada_value_is_changeable_p): Cleanup code.
Tested on x86_64-linux.
No new testcase provided, as this is just a refactoring.
Xavier Roirand [Mon, 10 Sep 2018 15:34:59 +0000 (10:34 -0500)]
(Ada) Fix printing of access to unconstrained arrays
Using this Ada code:
type String_Access is access String;
type Array_Of_String is array (1 .. 2) of String_Access;
Aos : Array_Of_String := (new String'("ab"), new String'("cd"));
When debugging with GDB, printing each Aos element displays:
(gdb) print Aos(1)
$2 = "ab"
(gdb) print Aos(2)
$3 = "cd"
Whereas it should display:
(gdb) print Aos(1)
$2 = (foo_r118_024.string_access) 0x635018
(gdb) print Aos(2)
$3 = (foo_r118_024.string_access) 0x635038
Notice that printing the entire array works:
(gdb) print Aos
$1 = (0x635018, 0x635038)
The problem was located in ada_value_print function and due to the fact
that the value_type used in this function was based on
value_enclosing_type rather than value_type itself.
In our example, the difference between the value_type and the
value_enclosing_type of the value is that the value_type contains an
additional typedef layer which is not present in the value_enclosing_type.
This typedef layer is GNAT's way to specify that the element is, at the
source level, an access to the unconstrained array, rather than the
unconstrained array.
Moreover, the value_enclosing_type is not really needed in that case and
the value_type can be used instead in this function, and this patch fixes
this.
gdb/ChangeLog:
* ada-valprint.c (ada_value_print): Use type instead of
enclosing type.
testsuite/ChangeLog:
* gdb.ada/access_to_unbounded_array.exp: New testcase.
* gdb.ada/access_to_unbounded_array/foo.adb: New file.
* gdb.ada/access_to_unbounded_array/pack.adb: New file.
* gdb.ada/access_to_unbounded_array/pack.ads: New file.
Tested: x86_64-linux
Xavier Roirand [Mon, 10 Sep 2018 15:33:32 +0000 (10:33 -0500)]
(Ada/MI) Fix -var-evaluate-expression for access to unconstrained arrays
Using this Ada code:
type String_Access is access String;
type Array_Of_String is array (1 .. 2) of String_Access;
Aos : Array_Of_String := (new String'("ab"), new String'("cd"));
In GDB/MI mode, create a variable which type is Aos, evaluate it:
(gdb) -var-create var1 * Aos
^done,name="var1",numchild="2",value="[2]",type="bar.array_of_string",thread-id="1",has_more="0"
Now print it:
(gdb) -var-list-children 1 var1
^done,numchild="2",children=[child={name="var1.1",exp="1",numchild="1",value="[2] \"ab\"", type="bar.string_access",thread-id="1"},child={name="var1.2",exp="2",numchild="1",value="[2] \"cd\"", type="bar.string_access",thread-id="1"}],has_more="0"
But printed fields "value" are wrong, since it should be:
^done,numchild="2",children=[child={name="var1.1",exp="1",numchild="1",value="0x634018",type="bar.string_access",thread-id="1"},child={name="var1.2",exp="2",numchild="1",value="0x634038",type="bar.string_access",thread-id="1"}],has_more="0"^M
Print each child of var1:
(gdb) -var-evaluate-expression var1.1
^done,value="[2] \"ab\""
(gdb) -var-evaluate-expression var1.2
^done,value="[2] \"cd\""
Whereas it should be
(gdb) -var-evaluate-expression var1.1
^done,value="0x635018"
(gdb) -var-evaluate-expression var1.2
^done,value="0x635038"
This patch fixes this.
gdb/ChangeLog:
* ada-lang.c (ada_value_subscript): Handle case when parameter is
an array of access to unconstrained array.
testsuite/ChangeLog
* gdb.ada/mi_string_access.exp: New testcase.
* gdb.ada/mi_string_access/bar.adb: New file.
* gdb.ada/mi_string_access/pck.adb: New file.
* gdb.ada/mi_string_access/pck.asd: New file.
Tested on x86_64-linux.
Xavier Roirand [Mon, 10 Sep 2018 15:32:00 +0000 (10:32 -0500)]
(Ada) New function ada_is_access_to_unconstrained_array
Add a new function to check if a given type is an access to an
unconstrained array. This function contains code that is present only
once in the current sources but will be used in a future patch.
gdb/ChangeLog:
* ada-lang.c (ada_is_access_to_unconstrained_array): New function.
(ada_check_typedef): Use it.
Tested on x86_64-linux.
Xavier Roirand [Mon, 10 Sep 2018 15:30:50 +0000 (10:30 -0500)]
(Ada) Fix -var-list-children MI command for union type
Using this Ada code:
type Union_Type (A : Boolean := False) is record
case A is
when True => B : Integer;
when False => C : Float;
end case;
end record;
pragma Unchecked_Union (Union_Type);
Ut : Union_Type := (A => True, B => 3);
In GDB/MI mode, once creating a varobj from variable "Ut" as follow:
(gdb) -var-create var1 * ut
^done,name="var1",numchild="2",value="{...}",type="foo.union_type",thread-id="1",has_more="0"
Printing the list of its children displays:
(gdb) -var-list-children 1 var1
^error,msg="Duplicate variable object name"
Whereas it should be
(gdb) -var-list-children 1 var1
^done,numchild="2",children=[child={name="var1.b",exp="b",numchild="0",value="3",type="integer",thread-id="1"},child={name="var1.c",exp="c",numchild="0",value="4.
20389539e-45",type="float",thread-id="1"}],has_more="0"
The problem occurs because ada_varobj_describe_struct_child wasn't
handling unions. This patch fixes this.
gdb/ChangeLog:
* ada-varobj.c (ada_varobj_describe_struct_child)
(ada_varobj_describe_child): Handle union case like struct one.
testsuite/ChangeLog
* gdb.ada/mi_var_union.exp: New testcase.
* gdb.ada/mi_var_union/bar.adb: New file.
* gdb.ada/mi_var_union/pck.adb: New file.
* gdb.ada/mi_var_union/pck.asd: New file.
Tested on x86_64-linux.
Tom Tromey [Sat, 8 Sep 2018 20:00:48 +0000 (14:00 -0600)]
Remove periods from Python section titles
This removes the remaining trailing periods from the Python section
titles. I thought these looked weird and I don't this is generally
done in the gdb documentation.
gdb/doc/ChangeLog
2018-09-10 Tom Tromey <tom@tromey.com>
* python.texi (Frames In Python, Blocks In Python)
(Symbols In Python, Symbol Tables In Python)
(Lazy Strings In Python): Remove periods from section titles.
Tom Tromey [Sat, 8 Sep 2018 19:50:09 +0000 (13:50 -0600)]
Swap two sentences in the Pretty Printing API node
I thought the start of the Pretty Printing API node read a bit
strangely. This patch swaps the first two sentences, which seems
better.
gdb/doc/ChangeLog
2018-09-10 Tom Tromey <tom@tromey.com>
* python.texi (Pretty Printing API): Swap sentence order.
Tom Tromey [Sat, 8 Sep 2018 19:44:24 +0000 (13:44 -0600)]
Mention virtual tables in Python dynamic_type documentation
PR python/16461 asks that the Python dynamic_type documentation
mention virtual tables; this patch implements that request.
gdb/doc/ChangeLog
2018-09-10 Tom Tromey <tom@tromey.com>
PR python/16461:
* python.texi (Values From Inferior): Mention use of virtual
table.
Tom Tromey [Sat, 8 Sep 2018 19:40:50 +0000 (13:40 -0600)]
Small typo fix in Basic Python node
I noticed that the decode_line documentation did not have parens
around the argument:
-- Function: gdb.decode_line [expression]
This patch fixes this oversight.
gdb/doc/ChangeLog
2018-09-10 Tom Tromey <tom@tromey.com>
* python.texi (Basic Python): Parenthesize argument to
decode_line.
Tom Tromey [Sat, 8 Sep 2018 19:37:26 +0000 (13:37 -0600)]
Mention Python versions in the documentation
This updates python.texi to note that gdb can be compiled against
either major version of Python. It also removes the "execfile"
example, because that is specific to Python 2.
gdb/doc/ChangeLog
2018-09-10 Tom Tromey <tom@tromey.com>
* python.texi (Python): Mention Python versions. Don't mention
execfile.
Tom Tromey [Sat, 8 Sep 2018 19:25:34 +0000 (13:25 -0600)]
Update Python unwinder documentation
PR python/19808 points out a few issues in the Python unwinder
documentation. This patch update the documentation for
create_unwind_info and read_register to address the issues noted, and
adds a cautionary note about writing an unwinder.
gdb/doc/ChangeLog
2018-09-10 Tom Tromey <tom@tromey.com>
PR python/19808:
* python.texi (Unwinding Frames in Python): Rewrite
create_unwind_info documentation. Update read_register
documentation and add a note about unwinder caution.
Tom Tromey [Sat, 8 Sep 2018 16:59:14 +0000 (10:59 -0600)]
Fix gdb.events.inferior_call documentation
PR python/18909 points out that the gdb.events.inferior_call
documentation was incorrect. This patch brings it in line with the
code.
gdb/doc/ChangeLog
2018-09-10 Tom Tromey <tom@tromey.com>
PR python/18909:
* python.texi (Events In Python): Fix inferior_call
documentation.
Tom Tromey [Sat, 8 Sep 2018 16:16:46 +0000 (10:16 -0600)]
Update Python frame filter documentation
This fixes a few frame filter documentation omissions noted in
PR python/17752.
gdb/doc/ChangeLog
2018-09-10 Tom Tromey <tom@tromey.com>
PR python/17752:
* python.texi (Frame Filter API): Remove period from subsection
title. Mention 100 as good default priority.
(Frame Decorator API): Remove period from subsection title.
Mention FrameDecorator module.
Tom Tromey [Sat, 8 Sep 2018 15:39:41 +0000 (09:39 -0600)]
Reword gdb.GdbError text
PR python/23108 points out that the gdb.GdbError documentation is
somewhat difficult to find. The exception is apparently just
mentioned in passing. This patch introduces a new table and adds a
bit more text to try to make it more obvious.
gdb/doc/ChangeLog
2018-09-10 Tom Tromey <tom@tromey.com>
PR python/23108:
* python.texi (Exception Handling): Rearrange gdb.GdbError text
and add a table.
Tom Tromey [Sat, 8 Sep 2018 15:29:18 +0000 (09:29 -0600)]
Avoid warnings from makeinfo
"make info" gives a number of warnings about the use of a "." in
@ref-like commands. These come from the ".info" suffix. I think this
suffix is redundant, and removing the suffix also removes the warning.
gdb/doc/ChangeLog
2018-09-10 Tom Tromey <tom@tromey.com>
* gdb.texinfo (Compilation): Use "gcc", not "gcc.info", in @xref.
(Machine Code): Use "binutils", not "binutils.info", in @pxref.
(Separate Debug Files): Use "ld", not "ld.info", in @ref.
* python.texi (Objfiles In Python): Use "ld", not "ld.info", in @ref.
Tom Tromey [Sat, 8 Sep 2018 15:13:37 +0000 (09:13 -0600)]
Fix help text for "python" command
PR python/18380 points out that the example in the "help python" text
will only work in Python 2. This changes the example to be valid
syntax for both Python 2 and Python 3.
gdb/ChangeLog
2018-09-10 Tom Tromey <tom@tromey.com>
PR python/18380:
* python/python.c (_initialize_python): Make example in "python"
help work in Python 3.
Tom Tromey [Sat, 8 Sep 2018 15:08:56 +0000 (09:08 -0600)]
Document that Frame.block can throw
PR python/16484 points out that Frame.block can throw an exception,
but this is not documented.
This patch fixes the documentation. Changing Frame.block to return
None would be nice, but I suspect it's too late for that change.
gdb/doc/ChangeLog
2018-09-10 Tom Tromey <tom@tromey.com>
PR python/16484:
* python.texi (Frames In Python): Document that Frame.block can
throw.
Tom Tromey [Sat, 8 Sep 2018 15:03:29 +0000 (09:03 -0600)]
Fix typo in pretty-printer example
PR python/23487 points out that the "disable pretty-printer" example
has a typo that makes it incorrect. This patch fixes the typo.
gdb/doc/ChangeLog
2018-09-10 Tom Tromey <tom@tromey.com>
PR python/23487:
* gdb.texinfo (Pretty-Printer Commands): Fix typo in example.
Tom Tromey [Sat, 8 Sep 2018 14:59:00 +0000 (08:59 -0600)]
Update Python Block.end documentation
PR python/16033 points out that Block.end doesn't describe whether it
is inclusive or exclusive. This patch fixes the documentation.
gdb/doc/ChangeLog
2018-09-10 Tom Tromey <tom@tromey.com>
PR python/16033:
* python.texi (Blocks In Python): Document that Block.end is
exclusive.
Eli Zaretskii [Mon, 10 Sep 2018 07:14:04 +0000 (10:14 +0300)]
Fix "make install-strip" failure to install gdb-add-index.sh
gdb/ChangeLog:
2018-09-10 Eli Zaretskii <eliz@gnu.org>
* Makefile.in (transformed_name): Use INSTALL_SCRIPT instead of
INSTALL_PROGRAM to install gdb-add-index.sh. Don't append
$(EXEEXT) to the script, as it is not a program.
Alan Modra [Mon, 10 Sep 2018 02:27:08 +0000 (11:57 +0930)]
PR23611, objcopy is not removing executable relocatable sections
BFD handles ELF relocation sections in an executable differently to
relocation sections in a relocatable object. For a relocatable
object, BFD carries the relocations as data associated with the
section to which they apply; The relocation section doesn't appear as
a separate section. For an executable, dynamic relocation sections do
appear as separate sections. This means that objcopy needs to use
different strategies when dealing with relocations.
When --remove-relocations was added to objcopy with commit
d3e5f6c8f1e, objcopy lost the ability to remove dynamic relocation
sections such as .rela.plt from executables using the option
"--remove-section=.rela.plt". This patch reinstates that
functionality.
I thought it best to keep --remove-relocations as is, rather than
extending to handle dynamic relocations as per the patch in the PR,
because executables linked with --emit-relocs may have both dynamic
and non-dynamic relocations. In that case --remove-relocataions=* is
useful to remove all the non-dynamic relocations.
PR binutils/23611
* objcopy.c (handle_remove_section_option): Consider .rela and
.rel sections for stripping directly as well as attached to the
associated section they relocate.
* doc/binutils.texi (remove-relocations): Specify that this
option removes non-dynamic relocation sections.
* testsuite/binutils-all/objcopy.exp
(objcopy_remove_relocations_from_executable): New test.
GDB Administrator [Mon, 10 Sep 2018 00:00:50 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Sun, 9 Sep 2018 07:13:17 +0000 (08:13 +0100)]
python: Make two functions return gdbpy_ref<>
I noticed that we release a gdbpy_ref in pretty_print_one_value only to
create it again later. This patch fills the gap by returning a
gdbpy_ref all the way.
gdb/ChangeLog:
* python/py-prettyprint.c (pretty_print_one_value): Return
gdbpy_ref<>.
(print_string_repr): Adjust.
(apply_varobj_pretty_printer): Return gdbpy_ref<>.
* python/python-internal.h (apply_varobj_pretty_printer): Return
gdbpy_ref<>.
* varobj.c (varobj_value_get_print_value): Adjust.
Tom Tromey [Sun, 9 Sep 2018 03:47:53 +0000 (21:47 -0600)]
Make py-prettyprint.exp test names unique
I noticed that the py-prettyprint.exp test names were not unique.
This patch fixes the problem via with_test_prefix.
gdb/testsuite/ChangeLog
2018-09-08 Tom Tromey <tom@tromey.com>
* gdb.python/py-prettyprint.exp: Use with_test_prefix.
Tom Tromey [Sat, 8 Sep 2018 20:40:38 +0000 (14:40 -0600)]
Allow a pretty-printer without a to_string method
PR python/16047 points out that, while the documentation says that the
to_string method is optional for a pretty-printer, the code disagrees
and throws an exception. This patch fixes the problem. varobj is
already ok here.
Tested on x86-64 Fedora 26.
gdb/ChangeLog
2018-09-08 Tom Tromey <tom@tromey.com>
PR python/16047:
* python/py-prettyprint.c (pretty_print_one_value): Check for
to_string method.
gdb/testsuite/ChangeLog
2018-09-08 Tom Tromey <tom@tromey.com>
PR python/16047:
* gdb.python/py-prettyprint.py (pp_int_typedef3): New class.
(register_pretty_printers): Register new printer.
* gdb.python/py-prettyprint.exp (run_lang_tests): Add int_type3
test.
* gdb.python/py-prettyprint.c (int_type3): New typedef.
(an_int_type3): New global.
GDB Administrator [Sun, 9 Sep 2018 00:01:14 +0000 (00:01 +0000)]
Automatic date update in version.in
Joel Brobecker [Sat, 8 Sep 2018 21:51:36 +0000 (16:51 -0500)]
(Ada) fix handling of expression with parameterless function call
Consider the following function, which takes no parameter and returns
an integer:
function Something return Integer;
For the purpose of this discussion, our function has been implemented
to always return 124:
function Something return Integer is
begin
return 124;
end Something;
In Ada, such function can been called without using the parentheses.
For instance, in the statement below, variable My_Value is assigned
the returned value from the call to Something:
My_Value := Something;
The Ada expression interpeter in GDB supports this case, as we can
see below:
(gdb) print something
$1 = 124
However, we get fairly strange results when trying to use this feature
as part of a larger expression. For instance:
(gdb) print something + 1
$2 = 248
The problem occurs while doing the resolution pass of the expression.
After prefixying the expression, we obtain the following expression:
0 BINOP_ADD
1 OP_VAR_VALUE Block @0x2021550, symbol @0x20213a0 (pck.something)
5 OP_LONG Type @0x1e3c170 (int), value 1 (0x1)
The resolution pass is then expected to remove the OP_VAR_VALUE
entry, and replace it with an OP_FUNCALL. This is what the call
to replace_operator_with_call in ada-lang.c::resolve_subexp is
expected to do:
if (deprocedure_p
&& (TYPE_CODE (SYMBOL_TYPE (exp->elts[pc + 2].symbol))
== TYPE_CODE_FUNC))
{
replace_operator_with_call (expp, pc, 0, 0,
exp->elts[pc + 2].symbol,
exp->elts[pc + 1].block);
exp = expp->get ();
}
The problem is that we're passing OPLEN (zero -- 4th parameter in
the call), and so replace_operator_with_call ends up removing zero
element from our expression, and inserting the corresponding OP_FUNCALL
instead. As a result, instead of having the OP_LONG (1) as the second
argument of the BINOP_ADD, it is now the OP_VAR_VALUE that we were
meant to replace. That OP_VAR_VALUE then itself gets transformed into
an OP_FUNCALL, with the same issue, and eventually, the resolved
expression now looks like this:
0 BINOP_ADD
1 OP_FUNCALL Number of args: 0
4 OP_VAR_VALUE Block @0x2021550, symbol @0x20213a0 (pck.something)
8 OP_FUNCALL Number of args: 0
11 OP_VAR_VALUE Block @0x2021550, symbol @0x20213a0 (pck.something)
15 OP_VAR_VALUE Block @0x2021550, symbol @0x20213a0 (pck.something)
19 OP_LONG Type @0x1e3c170 (int), value 1 (0x1)
This explains why we get twice the result of the function call
instead of its value plus one. The extra entries in the expression
at the end are just ignored.
This patch fixes the issue by calling replace_operator_with_call
with the correct OPLEN equal to the size of an OP_VAR_VALUE (4).
gdb/ChangeLog:
* ada-lang.c (resolve_subexp): Pass correct OPLEN in call to
replace_operator_with_call.
gdb/testsuite/ChangeLog:
* gdb.ada/expr_with_funcall: New testcase.
Joel Brobecker [Sat, 8 Sep 2018 21:50:00 +0000 (16:50 -0500)]
ada-lang.c::ada_value_cast: remove unnecessary parentheses
No other code change.
gdb/ChangeLog:
* ada-lang.c (ada_value_cast): Remove unnecessary parentheses.
Joel Brobecker [Sat, 8 Sep 2018 21:49:10 +0000 (16:49 -0500)]
(Ada) slightly incorrect bounds for type of array indexed by enum
Consider the following code:
type Enumerated is (Enum_A, Enum_B, Enum_C, Enum_Last);
type Table is array (Enumerated) of Integer;
-- Declare a variable of type Table to make sure the compiler
-- does emit the debugging information for that type.
V : Table := (others => 1);
Trying to print the type description of type Table, or of variable V
yields:
(gdb) ptype v
type = array (0 .. 3) of integer
(gdb) ptype example.table
type = array (0 .. 3) of integer
The compiler generates an XA type for the bounds...
<1><cf6>: Abbrev Number: 13 (DW_TAG_structure_type)
<cf7> DW_AT_name : example__table___XA
... whose member is described as being as:
<2><cfe>: Abbrev Number: 14 (DW_TAG_member)
<cff> DW_AT_name : example__enumerated
<d05> DW_AT_type : <0xc69>
This leads us to DIE 0xc69, which is our enumeration type:
<2><c69>: Abbrev Number: 4 (DW_TAG_enumeration_type)
<c6a> DW_AT_name : example__enumerated
Normally, for arrays, we expect a range type, rather than an enumerated
type. However, for a situation like this, where the range of the array
index is the full enumeration type, it seems like a waste to require
an extra range layer.
Instead, looking at print_range, we see that we print the bounds
of our range using the target type:
target_type = TYPE_TARGET_TYPE (type);
if (target_type == NULL)
target_type = type;
[...]
ada_print_scalar (target_type, lo, stream);
fprintf_filtered (stream, " .. ");
ada_print_scalar (target_type, hi, stream);
In this case, this causes us to use the enumerated type's subtype,
which is a plain integer type, hence the output we get. However,
there is no reason for using the target type, even in the TYPE_CODE_RANGE
situation. So this patch fixes the issue by simply printing the bounds
using the type being given, instead of its target type.
gdb/ChangeLog:
* ada-typeprint.c (print_range): Print the bounds using TYPE
rather than its TYPE_TARGET_TYPE.
A new test for this isn't necessary, as existing tests will demonstrate
this issue once a change in the compiler triggering the generation of
this type of debugging info gets pushed.
Joel Brobecker [Sat, 8 Sep 2018 21:48:04 +0000 (16:48 -0500)]
minor reformatting in ada-lang.c::ada_to_fixed_value
The arguments in the call to ada_to_fixed_value_create where
improperly aligned. But I also noticed that all the arguments
do fit on a single-line (up to 79 characters). So this patch
just fixes the code by putting everything on that same line.
gdb/ChangeLog:
* ada-lang.c (ada_to_fixed_value): Minor reformatting in
call to ada_to_fixed_value_create.
Jerome Guitton [Sat, 8 Sep 2018 21:47:11 +0000 (16:47 -0500)]
Handle PPC64 function descriptor in Ada decoding
On PPC64, the entry point of the function "FN" is ".FN" when a function
descriptor is used. One of the consequences of this is that GDB then
presents the name of the function to the user (eg: in backtraces) with
the leading dot, which is a low-level internal detail that the user
should not be seeing. The Ada decoding should strip it.
gdb/ChangeLog:
* ada-lang.c (ada_decode): strip dot prefix in symbol name.
No testcase added, as a number of existing testcases should already
demonstrate that problem.
Joel Brobecker [Sat, 8 Sep 2018 21:46:08 +0000 (16:46 -0500)]
(Ada) "catch assert" spurious internal error
We noticed while debugging a program compiled without assertions
enabled and using an older compiler that inserting a catchpoint
on failed assertions would cause an internal error:
(gdb) catch assert
../../src/gdb/ada-lang.c:13321: internal-error: ada_exception_sal:
Assertion`sym != NULL' failed.
A problem internal to GDB has been detected,
This is due to a combination of factors:
1. With older versions of the compiler, the function used as a hook
was provided by a unit that's different from the unit which
provides the hooks for the other exception catchpoints.
2. The program either does not use any assertion, or is compiled
without the assertions enabled.
With newer versions of the compiler, all such functions are provided
by the same unit, so should normally always be available. However,
there can still be reasons why this is not the case. Consider, for
instance, the case of a runtime compiled with -ffunction-sections,
in which case the hook might be eliminated unless assertions are
used and enabled.
So this patch transforms the internal error into a simple error.
gdb/ChangeLog:
* ada-lang.c (ada_exception_sal): Replace gdb_assert calls
by calls to error.
No testcase added, as the existing testcase gdb.ada/catch_ex.exp
should trigger it when using an older version of GNAT as the Ada
compiler.
Joel Brobecker [Sat, 8 Sep 2018 21:45:25 +0000 (16:45 -0500)]
(Ada) infinite loop when hitting unhandled exception catchpoint
When debugging a program compiled with an older version of GNAT,
hitting a catchpoint on unhandled exceptions can caused GDB to
got into an infinite loop. This happens while trying to find
the name of the exception that was raised. For that, it searches
for a frame corresponding to a specific function we know gets
called during the exeption handling.
In our particular case, the compiler was too old, and so GDB never
found that frame, and eventually got past the "main" subprogram,
all the way to system frames, where no symbol was available.
As a result, the code addresses could not be resolved into
a function name, leading to the infinite loop because of
a misplaced update of our loop variable "fi":
while (fi != NULL)
{
char *func_name;
enum language func_lang;
find_frame_funname (fi, &func_name, &func_lang, NULL);
if (func_name != NULL)
{
make_cleanup (xfree, func_name);
if (strcmp (func_name,
data->exception_info->catch_exception_sym) == 0)
break; /* We found the frame we were looking for... */
fi = get_prev_frame (fi);
}
}
If FUNC_NAME is NULL, then FI never gets updated ever after!
gdb/ChangeLog:
* ada-lang.c (ada_unhandled_exception_name_addr_from_raise):
Move update of loop variable "fi".
No testcase added, as the existing testcase gdb.ada/catch_ex.exp
should trigger it when using an older version of GNAT as the Ada
compiler.
Joel Brobecker [Sat, 8 Sep 2018 21:44:36 +0000 (16:44 -0500)]
(Ada) assigning packed array aggregate with variable as component
Consider a variable "PRA" defined as a packed array of packed
records as follow:
subtype Int is Integer range 0 .. 7;
type Packed_Rec is record
X, Y : Int;
W : Integer;
end record;
pragma Pack (Packed_Rec);
type Packed_RecArr is array (Integer range <>) of Packed_Rec;
pragma Pack (Packed_RecArr);
PRA : Packed_RecArr (1 .. 3);
Consider also a variable "PR", which is a Packed_Rec record,
declared as follow:
PR : Packed_Rec := (2, 2, 2);
Trying to assign a new value to PRA using an aggregate expression
where one of the components is our variable PR yields the wrong
result on big-endian machines (e.g. on ppc-linux):
(gdb) p pra := (pr, (2,2,2), (2,2,2))
$6 = ((x => 1, y => 0, w => 8), [...]
On the other hand, replacing "pr" by "(2,2,2)" does work.
I tracked the issue down to the bit offset we use to extract
the value of "PR" and copy it inside PRA. in value_assign_to_component,
we have:
if (gdbarch_bits_big_endian (get_type_arch (value_type (container))))
move_bits ([target buffer], [bit offset in target buffer],
[source buffer where PR is stored],
TYPE_LENGTH (value_type (component)) * TARGET_CHAR_BIT - bits,
bits, 1);
The issue is with the third-to-last argument, which provides the bit
offset where the value of PR is stored relative to its start address,
and therefore the bit offset relative to the start of the source
buffer passed as the previous argument.
In our case, component is a 38bit packed record whose TYPE_LENGTH
is 5 bytes, so the bit-offset that gets calculated is 2 (bits).
However, that formula only really applies to scalars, whereas
in our case, we have a record (struct). The offset in the non-scalar
case should be zero.
gdb/ChangeLog:
* ada-lang.c (value_assign_to_component): In the case of
big-endian targets, extract the bits of the given VAL
using an src_offset of zero if container is not a scalar.
gdb/testsuite/ChangeLog:
* gdb.ada/packed_array_assign: New testcase.