Jan Beulich [Tue, 6 Nov 2018 10:45:11 +0000 (11:45 +0100)]
x86: correctly handle VMOVD with EVEX.W set outside of 64-bit mode
For the flavors having a GPR operand EVEX.W is ignored outside of 64-bit
mode. The mnemonic should therefore not be KMOVQ, the GPR operand should
not name a non-existing 64-bit register, just like is already the case
for the AVX counterparts, and the Disp8 scaling factor should be 4
rather than 8.
Jan Beulich [Tue, 6 Nov 2018 10:44:31 +0000 (11:44 +0100)]
x86: correctly handle KMOVD with VEX.W set outside of 64-bit mode
For the flavors having a GPR operand VEX.W is ignored outside of 64-bit
mode. The mnemonic should therefore not be KMOVQ.
Jan Beulich [Tue, 6 Nov 2018 10:43:55 +0000 (11:43 +0100)]
x86: adjust {,E}VEX.W handling for PEXTR* / PINSR*
PEXTR{B,W} and PINSR{B,W}, just like for AVX512BW, are WIG, no matter
that the SDM uses a nonstandard description of that fact.
PEXTRD, even with EVEX.W set, ignores that bit outside of 64-bit mode,
just like its AVX counterpart.
Jan Beulich [Tue, 6 Nov 2018 10:42:54 +0000 (11:42 +0100)]
x86: adjust {,E}VEX.W handling outside of 64-bit mode
Many VEX-/EVEX-encoded instructions accessing GPRs become WIG outside of
64-bit mode. The respective templates should specify neither VexWIG nor
VexW0, but instead the setting of the bit should be determined from
- REX.W in 64-bit mode,
- the setting established through -mvexwig= / -mevexwig= otherwise.
This implies that the evex-wig2 testcase needs to go away, as being
wrong altogether.
A few test additions desirable here will only happen in later patches,
as the disassembler needs adjustments first.
Once again SSE2AVX templates are left alone, for it being unclear what
the behavior there should be.
Jan Beulich [Tue, 6 Nov 2018 10:42:08 +0000 (11:42 +0100)]
x86: fix various non-LIG templates
Quite a few templates were marked LIG while really the insns aren't.
Introduce descriptive shorthands once again, instead of continuing to
use the less legible original forms.
Jan Beulich [Tue, 6 Nov 2018 10:40:25 +0000 (11:40 +0100)]
x86: allow {store} to select alternative {,}PEXTRW encoding
The 0F C5 encoding is indeed a load type one (just that memory operands
are not permitted), while the 0F 3A 15 encoding is obviously a store.
Allow the pseudo prefixes to be used to select between them.
Also move (without any change) the secondary AVX512BW templates next to
the primary one.
Jan Beulich [Tue, 6 Nov 2018 10:39:42 +0000 (11:39 +0100)]
x86: add more VexWIG
Commits
6865c0435a ("x86: Support VEX/EVEX WIG encoding") and
6fa52824c3
("x86: Replace VexW=3 with VexWIG") omitted quite a few templates, oddly
enough in some cases despite testcases getting added (which then were
recorded with wrong expected output).
Also adjust VPMAXUB's attributes in the AVX512BW case to match ordering
of that of neighboring templates.
For the moment SSE2AVX templates are left alone, as it isn't clear
whether they were intentionally left untouched by the original commits
(the descriptions don't say either way).
In this context I question the decision in commit
0375113302 ("x86: Add
-mvexwig=[0|1] option to assembler") to move the logic to determine the
value of the W bit ahead of the decision whether to use 2-byte VEX:
While I can see this as one possible interpretation of -mvexwig=, the
other alternative (setting the value of the bit only if it actually
exists in the encoding) looks as reasonable to me, and perhaps even more
in line with us generally trying to pick the shortest encoding.
Jan Beulich [Tue, 6 Nov 2018 10:38:47 +0000 (11:38 +0100)]
x86: XOP VPHADD* / VPHSUB* are VEX.W0
Also avoid introducing further uses of VexW=1, by introducing and using
VexW0 at this occasion. Move the marker past all #define-s.
GDB Administrator [Tue, 6 Nov 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
Philippe Waroquiers [Mon, 5 Nov 2018 22:09:44 +0000 (23:09 +0100)]
ChangeLog for 'Fix 4K leak each time next/step changes of function.'
Philippe Waroquiers [Sun, 4 Nov 2018 16:48:57 +0000 (17:48 +0100)]
Fix 4K leak in open_source_file each time next/step changes of function.
When current function changes after a next/step, GDB shows a message such as:
(gdb) s
info_fun1 ()
at /bd/home/philippe/gdb/git/build_smallthing/gdb/testsuite/../../../smallthing/gdb/testsuite/gdb.base/info_qt.c:41
41 info_qt_inc++;
(gdb)
Valgrind reports a 4K definite leak for each such message (full stacktrace of
the leak below).
This patch fixes this leak, by transferring the current s->fullname to the
unique_xmalloc_ptr fullname given to find_and_open_source.
Note that I do not understand why find_and_open_source always tries to
re-execute the substitution rules on the provided fullname, as source.c
symtab_to_fullname just blindly returns a non NULL s->fullname, counting on
forget_cached_source_info to be called if search dir or substitution rules are
changed. Similarly, psymtab_to_fullname also just returns a non NULL
ps->fullname.
==15309== VALGRIND_GDB_ERROR_BEGIN
==15309== 69,632 bytes in 17 blocks are definitely lost in loss record 3,158 of 3,186
==15309== at 0x4C2BE2D: malloc (vg_replace_malloc.c:299)
==15309== by 0x5BF0987: realpath@@GLIBC_2.3 (canonicalize.c:78)
==15309== by 0x41F713: gdb_realpath(char const*) (pathstuff.c:72)
==15309== by 0x608833: openp(char const*, enum_flags<openp_flag>, char const*, int, std::unique_ptr<char, gdb::xfree_deleter<char> >*) (source.c:861)
==15309== by 0x608B89: find_and_open_source(char const*, char const*, std::unique_ptr<char, gdb::xfree_deleter<char> >*) (source.c:1049)
==15309== by 0x608D0B: open_source_file(symtab*) (source.c:1074)
==15309== by 0x609101: print_source_lines_base(symtab*, int, int, enum_flags<print_source_lines_flag>) (source.c:1291)
==15309== by 0x614ADF: print_frame_info(frame_info*, int, print_what, int, int) (stack.c:911)
==15309== by 0x614C45: print_stack_frame(frame_info*, int, print_what, int) (stack.c:181)
==15309== by 0x511D5E: print_stop_location (infrun.c:8044)
==15309== by 0x511D5E: print_stop_event(ui_out*) (infrun.c:8061)
==15309== by 0x40DD6D: cli_on_normal_stop(bpstats*, int) (cli-interp.c:145)
==15309== by 0x512409: operator() (functional:2127)
==15309== by 0x512409: notify (observable.h:106)
==15309== by 0x512409: normal_stop() (infrun.c:8334)
==15309== by 0x5156D8: fetch_inferior_event(void*) (infrun.c:3955)
==15309== by 0x4B3EEC: gdb_wait_for_event(int) (event-loop.c:859)
==15309== by 0x4B3FF6: gdb_do_one_event() [clone .part.4] (event-loop.c:322)
==15309== by 0x4B41B4: gdb_do_one_event (common-exceptions.h:219)
==15309== by 0x4B41B4: start_event_loop() (event-loop.c:371)
==15309== by 0x551217: captured_command_loop() (main.c:330)
==15309== by 0x55220C: captured_main (main.c:1177)
==15309== by 0x55220C: gdb_main(captured_main_args*) (main.c:1193)
==15309== by 0x29B4F7: main (gdb.c:32)
==15309==
==15309== VALGRIND_GDB_ERROR_END
gdb/ChangeLog
2018-11-04 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* source.c (open_source_file): Fix leak by transferring the
current s->fullname to the unique_xmalloc_ptr fullname given
to find_and_open_source.
H.J. Lu [Mon, 5 Nov 2018 19:12:28 +0000 (11:12 -0800)]
Correct ChangeLog entries for PR gas/23854 commit
commit
e60f4d3bdac25f02875afe36b7436bc2dfbbb978
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Mon Nov 5 09:01:26 2018 -0800
x86: Disable GOT relaxation with data prefix
Since linker GOT relaxation isn't valid for 16-bit GOT access, we should
disable GOT relaxation with data prefix.
H.J. Lu [Mon, 5 Nov 2018 17:01:26 +0000 (09:01 -0800)]
x86: Disable GOT relaxation with data prefix
Since linker GOT relaxation isn't valid for 16-bit GOT access, we should
disable GOT relaxation with data prefix.
gas/
PR gas/r23854
* config/tc-i386.c (output_disp): Disable GOT relaxation with
data prefix.
* testsuite/gas/i386/mixed-mode-reloc32.d: Updated.
ld/
PR gas/r23854
* testsuite/ld-i386/i386.exp: Run pr23854.
* testsuite/ld-x86-64/x86-64.exp: Likewwise.
* testsuite/ld-i386/pr23854.d: New file.
* testsuite/ld-i386/pr23854.s: Likewwise.
* testsuite/ld-i386/pr23854.d: Likewwise.
* testsuite/ld-x86-64/pr23854.d: Likewwise.
* testsuite/ld-x86-64/pr23854.s: Likewwise.
GDB Administrator [Mon, 5 Nov 2018 00:00:53 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Wed, 24 Oct 2018 22:45:41 +0000 (16:45 -0600)]
Return gdbpy_ref from gdbpy_get_varobj_pretty_printer
This changes gdbpy_get_varobj_pretty_printer to return a gdbpy_ref.
gdb/ChangeLog
2018-11-04 Tom Tromey <tom@tromey.com>
* varobj.c (install_default_visualizer): Update.
* python/python-internal.h (gdbpy_get_varobj_pretty_printer):
Return gdbpy_ref.
* python/py-prettyprint.c (search_pp_list): Return gdbpy_ref.
(find_pretty_printer_from_progspace)
(find_pretty_printer_from_gdb, find_pretty_printer)
(gdbpy_get_varobj_pretty_printer): Return gdbpy_ref.
(gdbpy_get_varobj_pretty_printer, gdbpy_default_visualizer):
Update.
Tom Tromey [Wed, 24 Oct 2018 22:40:00 +0000 (16:40 -0600)]
Return gdbpy_ref from some Python string functions
This changes python_string_to_unicode,
python_string_to_target_python_string, and
host_string_to_python_string to return gdbpy_ref.
gdb/ChangeLog
2018-11-04 Tom Tromey <tom@tromey.com>
* python/python.c (gdbpy_parameter_value): Update.
* python/python-internal.h (python_string_to_unicode)
(python_string_to_target_python_string)
(host_string_to_python_string): Return gdbpy_ref.
* python/py-utils.c (python_string_to_unicode)
(unicode_to_encoded_python_string)
(unicode_to_target_python_string)
(python_string_to_target_string)
(python_string_to_target_python_string): Return gdbpy_ref.
(python_string_to_host_string): Update.
(host_string_to_python_string): Return gdbpy_ref.
* python/py-symtab.c (stpy_get_filename, stpy_get_producer)
(stpy_fullname): Update.
* python/py-progspace.c (pspy_get_filename, pspy_solib_name):
Update.
* python/py-prettyprint.c (print_string_repr): Update.
* python/py-objfile.c (objfpy_get_filename, objfpy_get_username)
(objfpy_get_build_id): Update.
* python/py-breakpoint.c (bppy_get_location)
(bppy_get_expression, bppy_get_condition, bppy_get_commands):
Update.
Tom Tromey [Wed, 24 Oct 2018 22:33:23 +0000 (16:33 -0600)]
Return gdbpy_ref from gdb_py_object_from_*longest
This changes gdb_py_object_from_longest and
gdb_py_object_from_ulongest to return a gdbpy_ref rather than a
PyObject*.
gdb/ChangeLog
2018-11-04 Tom Tromey <tom@tromey.com>
* python/python-internal.h (gdb_py_object_from_longest)
(gdb_py_object_from_ulongest): Return gdbpy_ref.
* python/py-value.c (valpy_int): Update.
* python/py-utils.c (gdb_py_object_from_longest): Return
gdbpy_ref.
(gdb_py_object_from_ulongest): Likewise.
* python/py-type.c (typy_get_alignof): Update.
* python/py-linetable.c (ltpy_get_all_source_lines)
(ltpy_entry_get_line, ltpy_entry_get_pc): Update.
* python/py-block.c (blpy_get_start, blpy_get_end): Update.
GDB Administrator [Sun, 4 Nov 2018 00:01:27 +0000 (00:01 +0000)]
Automatic date update in version.in
H.J. Lu [Sat, 3 Nov 2018 22:03:34 +0000 (15:03 -0700)]
elfedit: Move ELF header magic bytes check to get_file_header
Skip the file if ELF header magic bytes doesn't match.
* elfedit.c (update_elf_header): Move EI_MAG? check to ...
(get_file_header): Here.
Philippe Waroquiers [Sat, 3 Nov 2018 20:33:42 +0000 (21:33 +0100)]
OBVIOUS Fix a typo in ada-lang.c add_prefix_cmd for "set ada"
Correct typo in add_prefix_cmd doc arg for "set ada".
Philippe Waroquiers [Sat, 3 Nov 2018 18:31:41 +0000 (19:31 +0100)]
OBVIOUS Remove a useless const char *type and its initialization.
Valgrind detected a leak for the line:
type = xstrdup ("auto");
as the compile probably dropped the type variable completely, as its
only usage was this initialization.
So, remove the useless variable.
Philippe Waroquiers [Sat, 3 Nov 2018 18:19:05 +0000 (19:19 +0100)]
OBVIOUS fix the month of the last gdb/ChangeLog entry to be 11 instead of 12.
GDB Administrator [Sat, 3 Nov 2018 00:01:18 +0000 (00:01 +0000)]
Automatic date update in version.in
H.J. Lu [Fri, 2 Nov 2018 23:45:41 +0000 (16:45 -0700)]
binutils: Add AC_FUNC_MMAP to configure.ac
Add AC_FUNC_MMAP to configure.ac so that HAVE_MMAP will be checked in
objdump.c and mmap is used if available.
* configure.ac (AC_FUNC_MMAP): New.
* config.in: Regenerated.
* configure: Likewise.
Joel Brobecker [Fri, 2 Nov 2018 17:37:29 +0000 (12:37 -0500)]
(Ada) Add ravenscar tasking support on AArch64
This patch adds support for debugging Ravenscar tasks, similar to what
is done for ppc and sparc.
gdb/ChangeLog:
* aarch64-ravenscar-thread.h, aarch64-ravenscar-thread.c:
New files.
* aarch64-tdep.c: #include "aarch64-ravenscar-thread.h".
(aarch64_gdbarch_init): Add call to register_aarch64_ravenscar_ops.
* Makefile.in (ALL_64_TARGET_OBS): Add aarch64-ravenscar-thread.o.
(HFILES_NO_SRCDIR): Add aarch64-ravenscar-thread.h.
(ALLDEPFILES): Add aarch64-ravenscar-thread.c.
* configure.tgt (cpu_obs) [aarch64*-*-*]: Add ravenscar-thread.o
and aarch64-ravenscar-thread.o.
* NEWS: Add entry documenting Ravenscar tasking support
on AArch64 ELF.
Philippe Waroquiers [Fri, 2 Nov 2018 13:20:59 +0000 (14:20 +0100)]
QUIET flag initialization missing in 2 places.
Fix by Matthew Malcomson <matthew.malcomson@arm.com>
Pushed as obvious.
Alan Modra [Fri, 2 Nov 2018 03:29:31 +0000 (13:59 +1030)]
[GOLD] make clean
Cleans a few more test files.
* Makefile.am (MOSTLYCLEANFILES): Define.
* Makefile.in: Regnerate.
* testsuite/Makefile.am (MOSTLYCLEANFILES): Add ver_test_14 and
gnu_property_test.
* testsuite/Makefile.in: Regnerate.
Alan Modra [Fri, 2 Nov 2018 02:34:31 +0000 (13:04 +1030)]
Squash readelf warning on zero sh_link reloc section
On readelf examining a static executable built with current glibc,
we get a silly warning.
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[ 0] NULL
0000000000000000 000000 000000 00 0 0 0
[ 1] .note.ABI-tag NOTE
0000000000400190 000190 000020 00 A 0 0 4
[ 2] .note.gnu.build-id NOTE
00000000004001b0 0001b0 000024 00 A 0 0 4
readelf: Warning: [ 3]: Link field (0) should index a symtab section.
[ 3] .rela.plt RELA
00000000004001d8 0001d8 000228 18 AI 0 20 8
This .rela.plt section contains only IRELATIVE relocations (which have
symbol index zero), so it isn't appropriate to warn. A zero sh_link
section is deliberately chosen for such a section (see PR10337 and
PR23850).
So this patch disables the SHT_REL* sh_link warning. I've also
removed the .rel.dyn/.rela.dyn section name test to disable the
sh_info warning for SHT_REL* sections. While relocation sections in
an executable need not specify the section they relocate (the
relocation sh_offset field is an address, not a section offset), that
isn't true in a relocatable file where sh_offset is relative to a
section. If .rela.dyn happens to exist in an ET_REL object it must
specify a valid section.
* readelf.c (process_section_headers): Don't warn on a zero
sh_info or sh_link for any reloc section in an executable or
shared library. Do warn for .rel.dyn/.rela.dyn in ET_REL.
Alan Modra [Fri, 2 Nov 2018 01:17:07 +0000 (11:47 +1030)]
PR23850, strip should not discard/move .rela.plt in executable
strip/objcopy can't deal with alloc reloc sections, not .rela.dyn or
.rela.plt in a dynamic executable, or .rela.plt/.rela.iplt in a static
executable. So, don't have BFD treat them as side-channel data
associated with the section they are relocating.
PR 23850
* elf.c (bfd_section_from_shdr): Treat SHF_ALLOC SHT_REL* sections
in an executable or shared library as normal sections.
Jim Wilson [Fri, 2 Nov 2018 00:25:15 +0000 (17:25 -0700)]
RISC-V: Don't allow unaligned breakpoints.
Some hardware doesn't support unaligned accesses, and a bare metal target
may not have an unaligned access trap handler. So if the PC is 2-byte
aligned, then use a 2-byte breakpoint to avoid unaligned accesses.
Tested on native RV64GC Linux with gdb testsuite and cross on spike
simulator and openocd with riscv-tests/debug.
gdb/
* riscv-tdep.c (riscv_breakpoint_kind_from_pc): New local unaligned_p.
Set if pcptr if unaligned. Return 2 if unaligned_p true. Update
debugging messages.
GDB Administrator [Fri, 2 Nov 2018 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in
Joel Brobecker [Thu, 1 Nov 2018 22:15:41 +0000 (15:15 -0700)]
(Ada) fix "error in expression" when using watch -location command
The "watch -l EXPR" command with the language set to Ada currently
fails with the following error:
(gdb) watch -l global_var
Error in expression, near ` 0x000000000062d2d8'.
The error occurs because GDB internally translate the request into
a watchpoint on a different expression: "* (TYPE *) ADDR" where
TYPE and ADDR are the type and the address of the object returned
by the expression's evaluation (resp.). So, in the example above,
global_var being an integer stored at 0x000000000062d2d8, GDB tries
to set a watchpoint on "* (integer *) 0x000000000062d2d8", which
fails, because we try to parse this expression with Ada, when
in fact it is not valid.
This patch fixes the issue by implementing the la_watch_location_expression
language method, using a syntax that the Ada parser recognizes
("{TYPE} ADDR").
gdb/ChangeLog:
* ada-lang.c (ada_watch_location_expression): New function.
(ada_language_defn): Set la_watch_location_expression to
ada_watch_location_expression.
gdb/testsuite/ChangeLog:
* gdb.ada/watch_minus_l: New testcase.
Joel Brobecker [Thu, 1 Nov 2018 22:08:57 +0000 (15:08 -0700)]
remove trailing spaces in print-utils.c ("int_string" function)
gdb/ChangeLog:
* print-utils.c (int_string): Remove unnecessary trailing spaces.
Joel Brobecker [Thu, 1 Nov 2018 22:05:40 +0000 (15:05 -0700)]
gdb.texinfo: Fix the output of the "info tasks 2" example
gdb/doc/ChangeLog:
* gdb.texinfo (Ada Tasks): Update the "info task 2" example
output to match the current implementation.
Joel Brobecker [Thu, 1 Nov 2018 21:46:05 +0000 (16:46 -0500)]
rs6000-tdep.c:skip_prologue avoid negative left shift
the rs6000-tdep.c::skip_prologue function has the following code:
unsigned int all_mask = ~((1U << fdata->saved_gpr) - 1);
/* Not a recognized prologue instruction.
Handle optimizer code motions into the prologue by continuing
the search if we have no valid frame yet or if the return
address is not yet saved in the frame. Also skip instructions
if some of the GPRs expected to be saved are not yet saved. */
if (fdata->frameless == 0 && fdata->nosavedpc == 0
&& (fdata->gpr_mask & all_mask) == all_mask)
break;
The problem is that fdata->saved_gpr is initialized to -1, and so,
if no instruction is found in the function's prologue that causes us
to set that field to a non-negative value, the sanitizer crashes
with the following message:
rs6000-tdep.c:1965:34: runtime error: shift exponent -1 is negative
This patch fixes the issue the by only doing the shift if saved_gpr
is not negative. When saved_gpr is negative, we actually don't need
the shift.
gdb/ChangeLog:
* rs6000-tdep.c (skip_prologue): Fix potential negative left
shifting.
Tested on ppc-linux native.
Also tested on ppc-elf (baremetal) using AdaCore's testsuite.
Jerome Guitton [Thu, 1 Nov 2018 21:32:30 +0000 (14:32 -0700)]
arm-pikeos: software single step
On ARM, PikeOS does not support hardware single step, causing various
semi-random errors when trying to next/step over some user code. So
this patch changes this target to use software-single-step instead.
The challenge is that, up to now, the PikeOS target was in all respects
identical to a baremetal target as far as GDB was concerned, meaning
we were using the baremetal osabi for this target too. This is no longer
possible, and we need to introduce a new OSABI variant. Unfortunately,
there isn't anything in the object file that would allow us to
differentiate between the two platforms. So we have to rely on a
heuristic instead, where we look for some known symbols that are
required in a PikeOS application (these symbols are expected to be
defined by the default linker script, and correspond to routines used
to allocate the application stack).
For the long run, the hope is that the stub implementation provided
by PikeOS is enhanced so that it includes vContSupported+ to the
$qSupported query, and then that the reply to the "vCont?" query
only return support for "continue" operations (thus exclusing "step"
operations). We could then use that information to reliably determine
at connection time that the target does not support single-stepping
and therefore automatically turn software single-stepping automatically
based on it.
gdb/ChangeLog:
* defs.h (enum gdb_osabi): Add GDB_OSABI_PIKEOS.
* osabi.c (gdb_osabi_names): Add name for GDB_OSABI_PIKEOS.
* arm-pikeos-tdep.c: New file.
* configure.tgt: Add arm-pikeos-tdep.o to the case of ARM
embedded system.
* Makefile.in (ALL_TARGET_OBS): Add arm-pikeos-tdep.o.
Tested on arm-pikeos and arm-elf using AdaCore's testsuite.
We also evaluated it on armhf-linux as a cross platform.
Simon Marchi [Thu, 1 Nov 2018 19:40:43 +0000 (15:40 -0400)]
Import mkdtemp gnulib module, fix mingw build
Building with mingw currently fails:
CXX unittests/mkdir-recursive-selftests.o
/home/emaisin/src/binutils-gdb/gdb/unittests/mkdir-recursive-selftests.c: In function ‘void selftests::mkdir_recursive::test()’:
/home/emaisin/src/binutils-gdb/gdb/unittests/mkdir-recursive-selftests.c:49:20: error: ‘mkdtemp’ was not declared in this scope
if (mkdtemp (base) == NULL)
^
Commit
e418a61a67a ("Move mkdir_recursive to common/filestuff.c")
moved this code, but also removed the HAVE_MKDTEMP guard which prevented
the mkdtemp call to be compiled on mingw.
We can either put back the HAVE_MKDTEMP ifdef, or import the gnulib
mkdtemp module, which provides the function for mingw. Since the
mkdir_recursive is susceptible to be used on mingw at some point, I
think it would be nice to have it tested on mingw, so I did the latter.
Once built, I tested it on Windows (copied the resulting gdb.exe on a
Windows machine, ran it, and ran "maint selftest mkdir_recursive"). It
failed, because the temporary directory is hardcoded to "/tmp/...". I
therefore added and used a new get_standard_temp_dir function, which
returns an appropriate temporary directory for the host platform.
gdb/ChangeLog:
* common/pathstuff.c (get_standard_temp_dir): New.
* common/pathstuff.h (get_standard_temp_dir): New.
* config.in: Re-generate.
* configure: Re-generate.
* configure.ac: Don't check for mkdtemp.
* gnulib/aclocal-m4-deps.mk: Re-generate.
* gnulib/aclocal.m4: Re-generate.
* gnulib/config.in: Re-generate.
* gnulib/configure: Re-generate.
* gnulib/import/Makefile.am: Re-generate.
* gnulib/import/Makefile.in: Re-generate.
* gnulib/import/m4/gnulib-cache.m4: Re-generate.
* gnulib/import/m4/gnulib-comp.m4: Re-generate.
* gnulib/import/m4/mkdtemp.m4: New file.
* gnulib/import/mkdtemp.c: New file.
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES):
Add mkdtemp module.
* unittests/mkdir-recursive-selftests.c (test): Use
get_standard_temp_dir.
(_initialize_mkdir_recursive_selftests): Remove HAVE_MKDTEMP
ifdef.
* compile/compile.c (get_compile_file_tempdir): Likewise.
Thomas Preud'homme [Thu, 1 Nov 2018 17:18:24 +0000 (17:18 +0000)]
Fix ld action in run_dump_test
run_dump_test proposes an ld action but when trying to make use of it in
a gas test it gave me some Tcl error. It turns out that it references
the check_shared_lib_support procedure and ld_elf_shared_opt variable
both only available in ld-lib.exp. I've thus moved the procedure in
binutils-common.exp and defined the variable needed in the various
default.exp of testsuite that seem to be using run_dump_test.
Since check_shared_lib_support itself references the ld variable not
defined in binutils-common I've defined it from LD in run_dump_test and
fixed LD and LDFLAGS to be defined as expected by run_dump_test in the
various default.exp of testsuite using run_dump_test.
2018-11-01 Thomas Preud'homme <thomas.preudhomme@linaro.org>
binutils/
* testsuite/config/default.exp: Define LD, LDFLAGS and
ld_elf_shared_opt.
* testsuite/lib/binutils-common.exp (check_shared_lib_support): Moved
from ld-lib.exp.
(run_dump_test): Set ld to $LD.
gas/
* testsuite/config/default.exp: Define LD, LDFLAGS and
ld_elf_shared_opt.
ld/
* testsuite/lib/ld-lib.exp (check_shared_lib_support): Moved to
binutils-common.exp.
Sangamesh Mallayya [Thu, 1 Nov 2018 10:23:59 +0000 (06:23 -0400)]
Reading signal handler frame in AIX
In AIX if gdb is debugging an application which has a signal handler
and reaches the signal handler frame, then we need to read the back
chain address from sigcontext saved on the stack, similarly the LR.
As backchain at an offset 0 will be 0, because we will have a
sigconext saved after the minimum stack size. So the correct
backchain will be at an offset after minimum stack and the LR at
an offset 8 will be of the signal millicode address.
If the back chain pointer is NULL and the LR field is in the kernel
segment(ex. 0x00004a14) then we can probably assume we are in a
signal handler.
sample output
(gdb) bt
0 sig_handle_aix (signo=11) at aix-sighandle.c:7
1 0x0000000000004a94 in ?? ()
(gdb)
expected output
(gdb) bt
0 sig_handle_aix (signo=11) at aix-sighandle.c:7
1 <signal handler called>
2 0x0000000100000748 in foo () at aix-sighandle.c:14
3 0x000000010000079c in main () at aix-sighandle.c:19
gdb/ChangeLog:
2018-11-01 Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
* rs6000-aix-tdep.c: Include "trad-frame.h" and "frame-unwind.h".
(SIG_FRAME_LR_OFFSET64): New define.
(SIG_FRAME_FP_OFFSET64): New define.
(aix_sighandle_frame_cache): New Function.
(aix_sighandle_frame_this_id): New Function.
(aix_sighandle_frame_prev_register): New Function.
(aix_sighandle_frame_sniffer): New Function.
(aix_sighandle_frame_unwind): New global variable.
(rs6000_aix_init_osabi): Install new frame unwinder.
gdb/testsuite/ChangeLog:
2018-11-01 Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
* gdb.arch/aix-sighandle.c: New file.
* gdb.arch/aix-sighandle.exp: New file.
GDB Administrator [Thu, 1 Nov 2018 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in
Sergio Durigan Junior [Tue, 30 Oct 2018 21:37:03 +0000 (17:37 -0400)]
Fix PR gdb/23835: Don't redefine _FORTIFY_SOURCE if it's already defined
Gentoo has a local GCC patch which always defines _FORTIFY_SOURCE=2.
This causes a build problem when building GDB there, because
"common/common-defs.h" also defines _FORTIFY_SOURCE=2:
CXX gdb.o
In file included from ../../gdb/defs.h:28:0,
from ../../gdb/gdb.c:19:
../../gdb/common/common-defs.h:71:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
#define _FORTIFY_SOURCE 2
<built-in>: note: this is the location of the previous definition
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:1619: gdb.o] Error 1
Even though it is questionable whether Gentoo's approach is the
correct one:
https://jira.mongodb.org/browse/SERVER-29982
https://bugs.gentoo.org/621036
it is still possible for GDB to be a bit more robust here and make
sure it just defines _FORTIFY_SOURCE if it hasn't been defined
already. This patch does that.
Tested by rebuilding and making sure the macro was defined.
gdb/ChangeLog:
2018-10-31 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/23835
* common/common-defs.h: Don't redefine _FORTIFY_SOURCE if it's
already defined.
Andrew Burgess [Sat, 27 Oct 2018 09:34:04 +0000 (10:34 +0100)]
gdb/riscv: Fix failures on rv64 in gdb.arch/riscv-reg-aliases.exp test
The gdb.arch/riscv-reg-aliases.exp test didn't take into account that
on RV64 (and RV128) the floating point registers are represented as a
union. This patch updates the test to handle this.
Tested against RV32 and RV64.
gdb/testsuite/ChangeLog:
* gdb.arch/riscv-reg-aliases.exp: Rewrite to take account of float
registers being unions.
Tom de Vries [Thu, 25 Oct 2018 14:54:49 +0000 (16:54 +0200)]
[gdb/testsuite] Factor out lib/valgrind.exp
Factor out common code related to vgdb setup and cleanup in valgrind-bt.exp,
valgrind-disp-step.exp and gdb.base/valgrind-infcall.exp.
Tested on x86_64-linux with and without --target_board=native-gdbserver.
2018-10-31 Tom de Vries <tdevries@suse.de>
* lib/valgrind.exp: New file.
(vgdb_start, vgdb_stop): New procs, factored out of ...
* gdb.base/valgrind-bt.exp: ... here, ...
* gdb.base/valgrind-disp-step.exp: ... here and ...
* gdb.base/valgrind-infcall.exp: ... here.
Joseph Myers [Wed, 31 Oct 2018 17:16:41 +0000 (17:16 +0000)]
Merge config/ changes from GCC.
config:
Merge from GCC:
2018-10-28 Iain Buclaw <ibuclaw@gdcproject.org>
* multi.m4: Set GDC.
2018-07-05 James Clarke <jrtc27@jrtc27.com>
* dfp.m4 (enable_decimal_float): Enable for x86_64*-*-gnu* to
catch x86_64 kFreeBSD and Hurd.
libdecnumber:
* configure: Regenerate.
zlib:
* configure: Regenerate.
Joseph Myers [Wed, 31 Oct 2018 17:10:56 +0000 (17:10 +0000)]
Merge autoconf / automake update changes from GCC.
Top level:
Merge from GCC:
PR bootstrap/82856
* multilib.am: New file. From automake.
config:
Merge from GCC:
PR bootstrap/82856
* math.m4, tls.m4: Use AC_LANG_SOURCE.
zlib:
Merge from GCC.
PR bootstrap/82856
* Makefile.am: Include multilib.am.
* Makefile.in: Regenerate.
Tom de Vries [Wed, 31 Oct 2018 15:33:46 +0000 (16:33 +0100)]
[gdb/testsuite] get_valueof: Don't output value in test name
The get_valueof outputs the value it has read as part of the test name. This
causes test names to vary from run to run, and adds some noise when diffing
test results. e.g.:
-PASS: gdb.guile/scm-ports.exp: buffered: get valueof "$sp" (
140737488343920)
+PASS: gdb.guile/scm-ports.exp: buffered: get valueof "$sp" (
140737488343968)
-PASS: gdb.guile/scm-ports.exp: unbuffered: get valueof "$sp" (
140737488343920)
+PASS: gdb.guile/scm-ports.exp: unbuffered: get valueof "$sp" (
140737488343968)
This patch removes that, since it's probably not very useful.
Tested on x86_64-linux.
2018-10-31 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (get_valueof): Don't output read value in test name.
Renlin Li [Wed, 31 Oct 2018 14:38:46 +0000 (14:38 +0000)]
Don't create got section while processing TLS Local Exec relocations.
For Local Exec TLS model, the offset of the variable from the thread pointer
can be computed at static link time. This doesn't require GOT indirection.
The initial change is a bad fix for a problem during TLS GD -> LE relaxation.
The proper fix is to check whether _GLOBAL_OFFSET_TABLE_ is referenced,
create got section if yes. And the fix is already in the repository.
bfd/
2018-10-31 Renlin Li <renlin.li@arm.com>
* elfnn-aarch64.c (elfNN_aarch64_check_relocs): Don't create got
section for Local Exec TLS model.
Pedro Franco de Carvalho [Mon, 29 Oct 2018 15:05:11 +0000 (12:05 -0300)]
[PowerPC] Include nat/linux-ptrace.h in native targets
Patch "[PowerPC] Add support for PPR and DSCR" used
PTRACE_GETREGSET/SETREGSET without including the fallback definitions
from "nat/linux-ptrace.h". Include this header to avoid breaking
builds in systems that don't define them.
gdb/ChangeLog:
2018-10-31 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* ppc-linux-nat.c: Include nat/linux-ptrace.h.
gdb/gdbserver/ChangeLog:
2018-10-31 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* linux-ppc-low.c: Include nat/linux-ptrace.h.
Andrew Burgess [Thu, 18 Oct 2018 13:04:27 +0000 (14:04 +0100)]
gdb: Handle ICC's unexpected void return type
I encountered a binary compiled with Intel's C Compiler (ICC) version
14.0.5.212, which seemed to contain some non-standard DWARF.
The DWARF spec (V5 3.3.2) says:
Debugging information entries for C void functions should not have
an attribute for the return type.
However, what I observed in the DWARF from this ICC compiled binary
was this:
...
<0><857>: Abbrev Number: 1 (DW_TAG_compile_unit)
<858> DW_AT_comp_dir : (indirect string, offset: 0x48d): /tmp/
<85c> DW_AT_language : 1 (ANSI C)
<85d> DW_AT_name : (indirect string, offset: 0x77c): filename.c
<861> DW_AT_producer : (indirect string, offset: 0x520): Intel(R) C Intel(R) 64 Compiler ...
<865> DW_AT_low_pc : 0x4378d0
<86d> DW_AT_high_pc : 0x4378f0
<875> DW_AT_stmt_list : 0xa37
...
<1><7ea>: Abbrev Number: 2 (DW_TAG_base_type)
<7eb> DW_AT_byte_size : 0
<7ec> DW_AT_encoding : 5 (signed)
<7ed> DW_AT_name : (indirect string, offset: 0x58f): void
...
<1><7f1>: Abbrev Number: 3 (DW_TAG_subprogram)
<7f2> DW_AT_decl_line : 268
<7f4> DW_AT_decl_column : 30
<7f5> DW_AT_decl_file : 1
<7f6> DW_AT_type : <0x7ea>
<7fa> DW_AT_prototyped : 1
<7fb> DW_AT_name : (indirect string, offset: 0x761): function_foo
<7ff> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x761): function_foo
<803> DW_AT_low_pc : 0x4378a0
<80b> DW_AT_high_pc : 0x4378d0
<813> DW_AT_external : 1
...
So function 'function_foo' has void return type, but still has a
DW_AT_type attribute for a 0 sized type called void.
What was found was that when the 'finish' command was used to leave
'function_foo', GDB would crash.
The problem is that in infcmd.c:print_return_value GDB tries to filter
out void return types, by looking for the TYPE_CODE_VOID, this fails
for the 'void' type as it has code TYPE_CODE_INT and GDB then tries to
print the 'void' type.
This eventually ends in a call to valprint.c:maybe_negate_by_bytes,
however, the len (length) of the value being negated is 0, which is
not detected or expected by this code, and invalid memory accesses
occur, some of which might cause GDB to crash.
The above DWARF was seen on version 14.0.5.212 of ICC.
I have also tested ICC versions 18.0.2.199 and 17.0.7.259, on both of
these versions, the DW_AT_type on the DW_TAG_subprogram has been
removed, bringing ICC inline with the DWARF standard, and with the
DWARF produced by GCC.
I only have limited access to these specific versions of ICC so I am
unable to get more specific details for when the generated DWARF
became non-standard or when it was changed to be more inline with the
DWARF standard.
Further testing revealed additional places where ICC produced 'void'
related DWARF that GDB struggles with. When I compiled code that
contained a function with this signature:
void funcx (void *arg);
on ICC 17/18, I got the following DWARF (notice the void return type
is now gone):
...
<1><32>: Abbrev Number: 2 (DW_TAG_subprogram)
<33> DW_AT_decl_line : 2
<34> DW_AT_decl_file : 1
<35> DW_AT_prototyped : 1
<36> DW_AT_name : (indirect string, offset: 0xc5): funcx
<3a> DW_AT_MIPS_linkage_name: (indirect string, offset: 0xc5): funcx
<3e> DW_AT_low_pc : 0x6dc
<46> DW_AT_high_pc : 0x703
<4e> DW_AT_external : 1
<2><4f>: Abbrev Number: 3 (DW_TAG_formal_parameter)
<50> DW_AT_decl_line : 2
<51> DW_AT_decl_file : 1
<52> DW_AT_type : <0x6a>
<56> DW_AT_name : arg
<5a> DW_AT_location : 2 byte block: 76 70 (DW_OP_breg6 (rbp): -16)
...
<1><6a>: Abbrev Number: 5 (DW_TAG_pointer_type)
<6b> DW_AT_type : <0x6f>
<1><6f>: Abbrev Number: 6 (DW_TAG_base_type)
<70> DW_AT_byte_size : 0
<71> DW_AT_encoding : 5 (signed)
<72> DW_AT_name : (indirect string, offset: 0xcb): void
...
However, the function argument 'arg' does still reference a 'void'
type. This case doesn't seem as obviously non-standard as the
previous one, but I think that the DWARF standard (V5 5.2) does
suggest that the above is not the recommended approach. If we compare
to the DWARF generated by GCC 7.3.1:
...
<1><68>: Abbrev Number: 5 (DW_TAG_subprogram)
<69> DW_AT_external : 1
<69> DW_AT_name : (indirect string, offset: 0x221): funcx
<6d> DW_AT_decl_file : 1
<6e> DW_AT_decl_line : 2
<6f> DW_AT_prototyped : 1
<6f> DW_AT_low_pc : 0x400487
<77> DW_AT_high_pc : 0x22
<7f> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<81> DW_AT_GNU_all_call_sites: 1
<81> DW_AT_sibling : <0xa0>
<2><85>: Abbrev Number: 6 (DW_TAG_formal_parameter)
<86> DW_AT_name : arg
<8a> DW_AT_decl_file : 1
<8b> DW_AT_decl_line : 2
<8c> DW_AT_type : <0xa0>
<90> DW_AT_location : 2 byte block: 91 58 (DW_OP_fbreg: -40)
...
<1><a0>: Abbrev Number: 7 (DW_TAG_pointer_type)
<a1> DW_AT_byte_size : 8
...
Here we see that the DW_TAG_pointer_type doesn't reference any further
type. This also seems out of line with the DWARF standard (which I
think recommends using a DW_TAG_unspecified_type entry), however GDB
does handle the GCC generated DWARF better.
If we look at how GDB handles the DWARF from GCC, then we see this:
(gdb) print *arg
Attempt to dereference a generic pointer.
While on the current HEAD of master dereferencing arg causes undefined
behaviour which will likely crash GDB (for the same reason as was
described above for the 'finish' case). On earlier versions of GDB
the ICC DWARF would cause this:
(gdb) print *arg
$1 = 0
In this patch both the return type, and general variable/parameter
type handling is fixed by transforming the synthetic void entries in
the DWARF, the ones that look like this:
<1><6f>: Abbrev Number: 6 (DW_TAG_base_type)
<70> DW_AT_byte_size : 0
<71> DW_AT_encoding : 5 (signed)
<72> DW_AT_name : (indirect string, offset: 0xcb): void
into GDB's builtin void type. My criteria for performing the fix are:
1. Binary produced by any version of ICC,
2. We're producing an integer type,
3. The size is 0, and
4. The name is "void".
I ignore the signed / unsigned nature of the integer.
Potentially we could drop the ICC detection too, this should be a
reasonably safe transformation to perform, however, I'm generally
pretty nervous when it comes to modifying how the DWARF is parsed so,
for now, I have restricted this to ICC only.
I also added an assertion to maybe_negate_by_bytes. This is nothing
to do with the actual fix, but should detect incorrect use of this
function in the future, without relying on undefined behaviour to
crash GDB.
I added a new test that makes use the of the testsuite's DWARF
generator. As it is tricky to create target independent tests that
pass function parameters using the DWARF generator (as specifying the
argument location is target specific) I have instead made use of a
global variable void*. This still shows the issue.
We already have a predicate in the DWARF parser to detect versions of
ICC prior to 14, however, this issue was spotted on a later version.
As a result I've added a new predicate that is true for any version of
ICC.
gdb/ChangeLog:
* dwarf2read.c (struct dwarf2_cu): Add producer_is_icc field.
(producer_is_icc): New function.
(check_producer): Set producer_is_icc field on dwarf2_cu.
(dwarf2_init_integer_type): New function.
(read_base_type): Call dwarf2_init_integer_type instead of
init_integer_type in all cases.
(dwarf2_cu::dwarf2_cu): Initialise producer_is_icc field.
* valprint.c (maybe_negate_by_bytes): Add an assertion that the
LEN is greater than 0.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/void-type.c: New file.
* gdb.dwarf2/void-type.exp: New file.
Andre Vieira [Wed, 31 Oct 2018 12:08:36 +0000 (12:08 +0000)]
[GAS][ARM] Fix ARMv8.1 AdvSIMD testism
This test never used to test the output of objdump as the old 'error-output'
check would exit after verifying the output in stdout and stderr from the
assembler. Given the use of warning_output now, the objdump runs and expects
its output to be verified. Assuming the correct disassembly of these
instructions is tested elsewhere given we never tested them here, this patch
removes the objdump run.
gas/ChangeLog
2018-10-31 Andre Vieira <andre.simoesdiasvieira@arm.com>
* testsuite/gas/arm/armv8-a+rdma-warning.d: Remove objdump execution.
Andre Vieira [Wed, 31 Oct 2018 12:05:19 +0000 (12:05 +0000)]
[GAS][ARM] Fix UDF testism
The old test never checked the objdump output since the 'error-output' directive
would exit and thus never run objdump. When this test was changed to adhere to
use the new warning_output we started to run objdump. The expected objdump
output was old and had bitrotten, this fixes the layout, as the "disassembly"
itself did not change.
gas/ChangeLog
2018-10-31 Andre Vieira <andre.simoesdiasvieira@arm.com>
* testsuite/gas/arm/udf.d: Update expected output.
Andre Vieira [Wed, 31 Oct 2018 11:57:38 +0000 (11:57 +0000)]
[GAS][ARM] Fix failing Armv1 test
This test has been failing for a while and it could be argued that since we
started testing 'arm7t' here (and not Armv1) the test itself was wrong. So I
changed the assembly to Armv1. Given the changes to objdump when
"disassembling all" it seemed like a good idea to force the disassembly to
'armv2' instead and actually accept the disassembly of the 26-bit Architecture
variants of tst, teq, cmn and cmp.
gas/ChangeLog
2018-10-31 Andre Vieira <andre.simoesdiasvieira@arm.com>
* testsuite/gas/arm/armv1.d: Assemble for Armv1 and disassemble for
Armv2.
GDB Administrator [Wed, 31 Oct 2018 00:00:40 +0000 (00:00 +0000)]
Automatic date update in version.in
Joel Sherrill [Tue, 30 Oct 2018 16:41:12 +0000 (16:41 +0000)]
[src/erc32] Use ncurses instead of termcap on Cygwin too
This removes a Cygwin-specific libtermcap hack that was dependent on
the presence of one of the multiple alternative libraries. The one it
was hard-coded to pick isn't included with Cygwin anymore.
According to Corinna, libtermcap was removed from Cygwin a long time
ago, and libncurses is used in Cygwin for a long time too.
The fix is to make Cygwin use the same autoconf code to figure out the
correct lib as any other target.
sim/erc32/Changelog:
2018-10-30 Joel Sherrill <joel@rtems.org>
* configure.ac: Remove the Cygwin-specific libtermcap.a hack
and use the standard logic to determine which library to use.
* configure: Regenerate.
Tom Tromey [Thu, 25 Oct 2018 15:00:52 +0000 (09:00 -0600)]
Check return value of bfd_init
Alan recently added a way for BFD library users to check whether they
were in fact loading a compatible version of BFD:
https://sourceware.org/ml/binutils/2018-10/msg00198.html
It seemed reasonable to me that gdb should do this check as well, in
case someone is dynamically linking against BFD.
Simon pointed out that an earlier version of the patch would cause a
gdb crash if the test failed. This version works around this by
lowering the call to bfd_init and adding a comment explaining where
'error' can safely be called in captured_main_1.
gdb/ChangeLog
2018-10-30 Tom Tromey <tom@tromey.com>
* main.c (captured_main_1): Check return value of bfd_init.
Sergio Durigan Junior [Thu, 25 Oct 2018 20:46:46 +0000 (16:46 -0400)]
Remove relational operators from common/offset-type.h
This patch is a follow-up of:
https://sourceware.org/ml/gdb-patches/2018-10/msg00601.html
It removes the declaration of the relational operators for
common/offset-type.h. As it turns out, these overloads are not being
used when a new offset type is declared, because, according to Pedro
Alves:
I think the functions aren't called because they are templates, and
thus the built-in (non-template) versions take precedence. If you
make them non-templates, then they should be called. But, the
built-ins are fine, so yeah, we can just remove the custom
definitions.
The patch also adjusts the comments on the code.
No regressions introduced.
gdb/ChangeLog:
2018-10-29 Sergio Durigan Junior <sergiodj@redhat.com>
* common/offset-type.h (DEFINE_OFFSET_REL_OP): Delete.
Adjust comments.
GDB Administrator [Tue, 30 Oct 2018 00:00:40 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Mon, 29 Oct 2018 17:28:24 +0000 (13:28 -0400)]
Revert "GDBSERVER: Listen on a unix domain (instead of TCP) socket if requested."
This reverts commit
f19c7ff839d7a32ebb48482ae7d318fb46ca823d.
Simon Marchi [Mon, 29 Oct 2018 17:28:15 +0000 (13:28 -0400)]
Revert "GDB: Document the unix::/path/to/socket of remote connection."
This reverts commit
6d0f8100c1a3053c967bec716e34b65dd054cc39.
Simon Marchi [Mon, 29 Oct 2018 17:24:23 +0000 (13:24 -0400)]
Revert "GDB: Fix documentation for invoking GDBSERVER"
This reverts commit
0a163825df5e98ad55de13eb3d3534d875943047.
Simon Marchi [Mon, 29 Oct 2018 17:22:47 +0000 (13:22 -0400)]
Revert "GDB: Remote target can now accept the form unix::/path/to/socket."
This reverts commit
88f5cc8cf8606478832c7d0d7b74755f3f625015.
Simon Marchi [Mon, 29 Oct 2018 17:22:42 +0000 (13:22 -0400)]
Revert "GDB: Only build for "unix:" connections if AF_LOCAL is supported."
This reverts commit
98a17ece013cb94cd602496b9efb92b8816b3953.
Rainer Orth [Mon, 29 Oct 2018 09:28:40 +0000 (10:28 +0100)]
Provide get_shell declaration in procfs.c
The Solaris build is currently broken:
/vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c: In member function ‘virtual void procfs_target::create_inferior(const char*, const string&, char**, int)’:
/vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c:3038:28: error: ‘get_shell’ was not declared in this scope
const char *shell_file = get_shell ();
^~~~~~~~~
/vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c:3038:28: note: suggested alternative: ‘getusershell’
const char *shell_file = get_shell ();
^~~~~~~~~
getusershell
The following patch fixes this. Tested on amd64-pc-solaris2.11.
2018-10-29 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* procfs.c: Include common/pathstuff.h.
Alan Modra [Mon, 29 Oct 2018 07:40:06 +0000 (18:10 +1030)]
Report scripts and libraries searched for ld --trace
The idea of this change is to make -t output useful for users wanting
to package all the object files involved in linking for a bug report.
Something like the following should do the trick.
gcc hello.c -save-temps -Wl,-t | xargs realpath | sort | uniq > files
tar cJf test.tar.xz `cat files`
* ldlang.c (load_symbols): When -t, print file names for script
files and archives.
* ldmain.c (trace_files): Make an int.
(add_archive_element): Print archive elements only with multiple
-t options, or when archive is thin.
* ldmain.h (trace_files): Update.
* ldmisc.c (vfinfo): Don't print both original path and path in
sysroot.
* lexsup.c (parse_args <t>): Increment trace_files.
Alan Modra [Mon, 29 Oct 2018 07:39:59 +0000 (18:09 +1030)]
Remove some ld --trace output
This output really belongs in ld --verbose.
* ldmain.c (main): Print emulation mode and "deleting executable"
for --verbose, not --trace.
(add_archive_element): Only print "no new IR symbols" for --verbose.
Alan Modra [Mon, 29 Oct 2018 07:39:39 +0000 (18:09 +1030)]
Simplify --sysroot=/
Prepending '/' to absolute paths doesn't gain us much, and results in
the current implementation of --trace emitting silly path-in-sysroot
output, eg.
/lib/ld-linux-x86-64.so.2 (//lib/ld-linux-x86-64.so.2)
* ldmain.c (get_sysroot): Return "" for "--sysroot=/".
Alan Modra [Mon, 29 Oct 2018 06:07:24 +0000 (16:37 +1030)]
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has
found its way into many gas files led to bugs, typically when code
expecting a symbolS* to point at a struct symbol is presented with a
struct local_symbol. Also, commit
158184ac9e changed these structs in
2012 but didn't catch all places where symbol bsym was being used to
test for a local_symbol.
* Makefile.am (HFILES): Delete struc-symbol.h.
* doc/internals.texi: Delete struc-symbol.h reference and out
of date local symbol description.
* struc-symbol.h: Delete. Move contents to..
* symbols.c: ..here.
(symbol_on_chain, symbol_symbolS): New functions.
* symbols.h (symbol_on_chain, symbol_symbolS): Declare.
* cgen.c: Don't #include struc-symbol.h.
(gas_cgen_parse_operand): Don't test for local_symbol using
bsym, instead call symbol_symbolS. Use symbol_get_bfdsym.
(weak_operand_overflow_check, make_right_shifted_expr): Use
symbol accessors.
* config/obj-coff.c: Don't #include struc-symbol.h.
(GET_FILENAME_STRING): Delete.
* config/obj-elf.c: Don't #include struc-symbol.h.
(elf_file_symbol): Use symbol accessors.
(elf_adjust_symtab): Call symbol_on_chain.
* config/obj-evax.c: Don't #include struc-symbol.h.
* config/tc-nds32.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-alpha.c: Likewise.
(add_to_link_pool, s_alpha_comm): Use symbol accessors.
* config/tc-arc.c: Don't #include struc-symbol.h.
(arc_check_relocs): Use symbol accessors, testing gas symbol
section rather than bfd symbol section.
* config/tc-avr.c: Don't #include struc-symbol.h.
(avr_patch_gccisr_frag): Use symbol accessors.
* config/tc-bfin.c: Don't #include struc-symbol.h.
(bfin_loop_beginend): Use symbol accessors.
* config/tc-csky.c: Don't #include struc-symbol.h.
(v2_work_movih, v2_work_ori): Use symbol accessors. Check for
absolute symbol as well as O_constant.
* config/tc-riscv.c: Don't #include struc-symbol.h.
(riscv_pre_output_hook): Use symbol accessors.
* config/tc-s390.c: Don't #include struc-symbol.h.
(s390_literals): Use symbol accessors.
* config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use
symbol accessors.
(s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't
test symbol bsym.
* config/tc-score7.c: Don't #include struc-symbol.h.
(s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors.
(s7_b32_relax_to_b16): Don't test symbol bsym.
* config/tc-sh.c: Don't #include struc-symbol.h.
(insert_loop_bounds): Use symbol accessors.
(sh_frob_section): Remove bogus symbol canonicalization.
* config/tc-tic54x.c: Don't #include struc-symbol.h.
(tic54x_bss): Use symbol accessors.
* config/tc-tilegx.c: Don't #include struc-symbol.h.
(emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors.
* config/tc-tilepro.c: Don't #include struc-symbol.h.
(emit_tilepro_instruction, tilepro_parse_name): Use accessors.
* config/tc-xtensa.c: Don't #include struc-symbol.h.
(xg_assemble_vliw_tokens): Use symbol accessors.
(xg_order_trampoline_chain): Likewise.
* ehopt.c: Don't #include struc-symbol.h.
(check_eh_frame): Correct local symbol test. Use symbol accessors.
* write.c: Don't #include struc-symbol.h.
(create_note_reloc, maybe_generate_build_notes): Use symbol accessors.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
Alan Modra [Thu, 25 Oct 2018 23:31:54 +0000 (10:01 +1030)]
ld -r script fixes
For ld -r, we generally set the VMA of sections to zero. This is done
to make the output of ld -r most similar to that output by the
assembler, which generally has sections starting at VMA zero. In some
cases that covers for backend bugs which would mis-handle relocatable
object files with non-zero section VMAs.
This patch fixes a few sections that didn't have zero VMAs for ld -r.
A missing zero on .note.gnu.build-id and .eh_frame_hdr doesn't matter
much since these are linker generated symbols only output on final
link, but it's good to be consistent.
* Makefile.am (ei386beos.c, ei386go32.c): Correct dependencies.
* Makefile.in: Regenerate.
* scripttempl/elf.sc (.note.gnu.build-id, .eh_frame_hdr): Set
address with ${RELOCATING-0}.
* scripttempl/arclinux.sc: Likewise.
* scripttempl/armbpabi.sc: Likewise.
* scripttempl/avr.sc: Likewise.
* scripttempl/elf64hppa.sc: Likewise.
* scripttempl/elf_chaos.sc: Likewise.
* scripttempl/elfarc.sc: Likewise.
* scripttempl/elfxtensa.sc: Likewise.
* scripttempl/mep.sc: Likewise.
* scripttempl/nds32elf.sc: Likewise.
* scripttempl/pru.sc: Likewise.
* scripttempl/elf32msp430.sc: Likewise, and for other sections.
* scripttempl/epiphany_4x4.sc: Similarly.
John Darrington [Sun, 28 Oct 2018 19:14:24 +0000 (20:14 +0100)]
GDB: Only build for "unix:" connections if AF_LOCAL is supported.
Commit
f19c7ff839d7a32ebb48482ae7d318fb46ca823d added a new member to the
prefixes array which included a use of the symbol AF_LOCAL. Unfortunately,
not all systems declare this symbol. This change only compiles the "unix:"
member if the system knows about AF_LOCAL.
gdb/ChangeLog:
* configure.ac: New test HAVE_AF_LOCAL
* common/netstuff.c (parse_connection_spec) [prefixes]: Only compile "unix:"
if HAVE_AF_LOCAL is true.
* configure: regenerate.
* config.in: regenerate.
GDB Administrator [Mon, 29 Oct 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Sun, 28 Oct 2018 10:43:26 +0000 (10:43 +0000)]
gdb/riscv: Add back missing braces in riscv-linux-nat.c
In this commit:
commit
ee67fd7f3f6ca78eede2862e309c0bcf266bbd7e
Date: Thu Oct 25 12:03:31 2018 +0100
gdb/riscv: Use correct regnum in riscv_linux_nat_target::fetch_registers
I incorrectly removed a set of braces in violation of the GDB coding
standard. This commit adds them back.
gdb/ChangeLog:
* riscv-linux-nat.c (riscv_linux_nat_target::fetch_registers):
Add missing braces. No functional change.
Alan Modra [Sun, 28 Oct 2018 05:44:35 +0000 (16:14 +1030)]
Correct ChangeLog
Alan Modra [Sun, 28 Oct 2018 05:27:17 +0000 (15:57 +1030)]
PR23837, Segmentation fault in resolve_symbol_value
Local symbols don't have a sy_frag field.
PR 23837
* config/tc-hppa.c: Don't include struc-symbol.h.
(pa_build_unwind_subspace): Call get_symbol_frag rather than
referencing sy_frag.
GDB Administrator [Sun, 28 Oct 2018 00:00:46 +0000 (00:00 +0000)]
Automatic date update in version.in
Philippe Waroquiers [Sat, 27 Oct 2018 19:25:44 +0000 (21:25 +0200)]
OBVIOUS Use report_unrecognized_option_error in 'demangle' and 'info macro' commands.
Rather than have some local logic to throw an error for an unrecognized option,
use the new cli-utils.h function throwing an error.
At the same time, fix some wrong indentation in info_macro_command
and fix a small bug in 'demangle' error handling:
Without the patch:
(gdb) demangle -L c++ abcd
Unrecognized option 'c++' to demangle command. Try "help demangle".
(gdb)
With the patch:
(gdb) demangle -L c++ abcd
Unrecognized option '-L' to demangle command. Try "help demangle".
2018-10-27 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* macrocmd.c (info_macro_command): Use report_unrecognized_option_error
to report a bad option and fix indentation.
* demangle.c (demangle_command): Use report_unrecognized_option_error
to report a bad option and correctly report the bad option.
Tom Tromey [Mon, 17 Sep 2018 18:29:22 +0000 (12:29 -0600)]
Cache a copy of the user's shell on macOS
Recent versions of macOS have a feature called System Integrity
Protection. Among other things, This feature prevents ptrace from
tracing certain programs --- for example, the programs in /bin, which
includes typical shells.
This means that startup-with-shell does not work properly. This is PR
cli/23364. Currently there is a workaround in gdb to disable
startup-with-shell when this feature might be in use.
This patch changes gdb to be a bit more precise about when
startup-with-shell will not work, by checking whether the shell
executable is restricted.
If the shell is restricted, then this patch will also cause gdb to
cache a copy of the shell in the gdb cache directory, and then reset
the SHELL environment variable to point to this copy. This lets
startup-with-shell work again.
Tested on High Sierra by trying to start a program using redirection,
and by running startup-with-shell.exp.
gdb/ChangeLog
2018-10-27 Tom Tromey <tom@tromey.com>
PR cli/23364:
* darwin-nat.c (copied_shell): New global.
(may_have_sip): Rename from should_disable_startup_with_shell.
(copy_shell_to_cache, maybe_cache_shell): New functions.
(darwin_nat_target::create_inferior): Update. Use
copied_shell.
Tom Tromey [Thu, 20 Sep 2018 22:30:47 +0000 (16:30 -0600)]
Do not reopen temporary files
The current callers of mkostemp close the file descriptor and then
re-open it with fopen. It seemed better to me to continue to use the
already-opened file descriptor, so this patch rearranges the code a
little in order to do so. It takes care to ensure that the files are
only unlinked after the file descriptor in question is closed, as
before.
gdb/ChangeLog
2018-10-27 Tom Tromey <tom@tromey.com>
* unittests/scoped_fd-selftests.c (test_to_file): New function.
(run_tests): Call test_to_file.
* dwarf-index-write.c (write_psymtabs_to_index): Do not reopen
temporary files.
* common/scoped_fd.h (scoped_fd::to_file): New method.
Tom Tromey [Thu, 20 Sep 2018 22:04:04 +0000 (16:04 -0600)]
Use mkostemp, not mkstemp
I noticed that gdb could leak file descriptors coming from mkstemp.
This patch fixes the problem by importing the gnulib mkostemp instead,
and then changing gdb to pass O_CLOEXEC.
A small gnulib patch was needed. This has already been accepted
upstream.
gdb/ChangeLog
2018-10-27 Tom Tromey <tom@tromey.com>
* unittests/scoped_mmap-selftests.c (test_normal): Use
gdb_mkostemp_cloexec.
* unittests/scoped_fd-selftests.c (test_destroy, test_release):
Use gdb_mkostemp_cloexec.
* gnulib/aclocal-m4-deps.mk, gnulib/aclocal.m4,
gnulib/config.in, gnulib/configure,
gnulib/import/Makefile.am, gnulib/import/Makefile.in,
gnulib/import/m4/gnulib-cache.m4,
gnulib/import/m4/gnulib-comp.m4: Update.
* gnulib/import/m4/mkostemp.m4: New file.
* gnulib/import/m4/mkstemp.m4: Remove.
* gnulib/import/mkostemp.c: New file.
* gnulib/import/mkstemp.m4: Remove.
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Remove
mkstemp, add mkostemp. Apply new patch.
* gnulib/import/stdlib.in.h: Apply patch.
* gnulib/patches/0002-mkostemp-mkostemps-Fix-compilation-error-in-C-mode-o.patch:
New file.
* dwarf-index-write.c (write_psymtabs_to_index): Use
gdb_mkostemp_cloexec.
* common/filestuff.h (gdb_mkostemp_cloexec): New function.
Tom Tromey [Mon, 17 Sep 2018 16:48:20 +0000 (10:48 -0600)]
Move mkdir_recursive to common/filestuff.c
This moves mkdir_recursive from dwarf-index-cache.c to
common/filestuff.c, and also changes it to return a boolean that says
whether or not it worked.
gdb/ChangeLog
2018-10-27 Tom Tromey <tom@tromey.com>
* unittests/mkdir-recursive-selftests.c: New file.
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
unittests/mkdir-recursive-selftests.c.
* dwarf-index-cache.c (mkdir_recursive): Move to
common/filestuff.c.
(index_cache::store): Check return value of mkdir_recursive.
(create_dir_and_check, test_mkdir_recursive): Move to new file.
(_initialize_index_cache): Don't register test.
* common/filestuff.h (mkdir_recursive): Declare.
* common/filestuff.c (mkdir_recursive): Move from
dwarf-index-cache.c. Return bool.
Tom Tromey [Fri, 14 Sep 2018 17:28:45 +0000 (11:28 -0600)]
Move make_temp_filename to common/pathstuff.c
Currently make_temp_filename is a function local to
write_psymtabs_to_index. This patch moves it to pathstuff.c so that
it can be used from other places in gdb.
gdb/ChangeLog
2018-10-27 Tom Tromey <tom@tromey.com>
* dwarf-index-write.c (write_psymtabs_to_index): Move
make_temp_filename to common/pathstuff.c.
* common/pathstuff.h (make_temp_filename): Declare.
* common/pathstuff.c (make_temp_filename): New function, moved
from dwarf-index-write.c.
Tom Tromey [Fri, 14 Sep 2018 16:35:45 +0000 (10:35 -0600)]
Unify shell-finding logic
I noticed several places in gdb that were using getenv("SHELL") and
then falling back to "/bin/sh" if it returned NULL. This unifies
these into a single function.
gdb/ChangeLog
2018-10-27 Tom Tromey <tom@tromey.com>
* procfs.c (procfs_target::create_inferior): Use get_shell.
* cli/cli-cmds.c (shell_escape): Use get_shell.
* windows-nat.c (windows_nat_target::create_inferior): Use
get_shell.
* common/pathstuff.c (get_shell): New function.
* nat/fork-inferior.c (SHELL_FILE, get_startup_shell): Remove.
(fork_inferior): Use get_shell.
* common/pathstuff.h (get_shell): Declare.
Philippe Waroquiers [Thu, 25 Oct 2018 20:42:58 +0000 (22:42 +0200)]
Remove a bunch of usages of gdb_suppress_tests in 'runto_main'.
In the 'info -q -t' patch series, I started a new test from
gdb.threads/threadapply.exp, that uses an obsolete way to do
runto_main.
This patch changes all occurrences of runto_main using gdb_suppress_tests
to use instead fail+return.
Note that there are still about 220 occurrences of gdb_suppress_tests
but unclear (to me) if these can be similarly trivially be replaced by a
fail+return. Further cleanup can be done in follow-up patches.
Tests run on Debian/x86_64.
gdb/testsuite/ChangeLog
2018-10-27 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.arch/altivec-regs.exp: Do not use gdb_suppress_tests in
runto_main, use fail + return instead.
gdb.arch/amd64-byte.exp: Likewise.
gdb.arch/amd64-dword.exp: Likewise.
gdb.arch/amd64-word.exp: Likewise.
gdb.arch/e500-abi.exp: Likewise.
gdb.arch/e500-regs.exp: Likewise.
gdb.arch/gdb1291.exp: Likewise.
gdb.arch/gdb1431.exp: Likewise.
gdb.arch/i386-avx.exp: Likewise.
gdb.arch/i386-byte.exp: Likewise.
gdb.arch/i386-prologue.exp: Likewise.
gdb.arch/i386-sse.exp: Likewise.
gdb.arch/i386-word.exp: Likewise.
gdb.arch/iwmmxt-regs.exp: Likewise.
gdb.arch/pa-nullify.exp: Likewise.
gdb.arch/powerpc-prologue.exp: Likewise.
gdb.arch/s390-tdbregs.exp: Likewise.
gdb.arch/vsx-regs.exp: Likewise.
gdb.asm/asm-source.exp: Likewise.
gdb.base/auxv.exp: Likewise.
gdb.base/bigcore.exp: Likewise.
gdb.base/overlays.exp: Likewise.
gdb.base/savedregs.exp: Likewise.
gdb.base/setshow.exp: Likewise.
gdb.base/sigaltstack.exp: Likewise.
gdb.base/sigbpt.exp: Likewise.
gdb.base/siginfo-addr.exp: Likewise.
gdb.base/siginfo-obj.exp: Likewise.
gdb.base/siginfo-thread.exp: Likewise.
gdb.base/siginfo.exp: Likewise.
gdb.base/signull.exp: Likewise.
gdb.base/sigrepeat.exp: Likewise.
gdb.base/structs2.exp: Likewise.
gdb.threads/threadapply.exp: Likewise.
gdb.threads/watchthreads.exp: Likewise.
gdb.threads/watchthreads2.exp: Likewise.
Philippe Waroquiers [Thu, 5 Jul 2018 20:39:41 +0000 (22:39 +0200)]
Add a test case for info args|functions|locals|variables [-q] [-t TYPEREGEXP] [NAMEREGEXP]
Add a test case for info args|functions|locals|variables [-q] [-t TYPEREGEXP] [NAMEREGEXP]
gdb/testsuite/ChangeLog
2018-10-27 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/info_qt.c: New file.
* gdb.base/info_qt.exp: New file.
Philippe Waroquiers [Sun, 1 Jul 2018 21:02:41 +0000 (23:02 +0200)]
Announce changes in NEWS to info [args|functions|locals|variables]
Announce changes in NEWS to info [args|functions|locals|variables]
gdb/ChangeLog
2018-10-27 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* NEWS: Mention changes to 'info [args|functions|locals|variables]'
Philippe Waroquiers [Sun, 1 Jul 2018 21:02:14 +0000 (23:02 +0200)]
Document changes to info [args|functions|locals|variables]
Document changes to info [args|functions|locals|variables]
gdb/doc/ChangeLog
2018-10-27 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.texinfo (Information About a Frame): Document changes
to 'info args' and 'info locals'.
(Examining the Symbol Table): Document changes to 'info functions'
and 'info variables'.
Philippe Waroquiers [Sun, 1 Jul 2018 20:56:56 +0000 (22:56 +0200)]
Add [-q] [-t TYPEREGEXP] [NAMEREGEXP] args to info [args|functions|locals|variables]
Add [-q] [-t TYPEREGEXP] [NAMEREGEXP] args to info [args|functions|locals|variables]
Main changes are:
* stack.c: Add two regexp preg and treg to print_variable_and_value_data
and used them inside do_print_variable_and_value to filter the
variables to print.
* symtab.h: Add a new function bool treg_matches_sym_type_name, that
factorises type matching logic.
* symtab.c: Add type/name matching logic to 'info functions|variables'.
* stack.c : Add type/name matching logic to 'info args|locals'.
gdb/ChangeLog
2018-10-27 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* stack.c (print_variable_and_value_data): Add preg and treg.
(print_frame_local_vars): Add quiet, regexp and t_regexp arguments,
and update callers.
(print_frame_arg_vars): Likewise.
(prepare_reg): New function.
(info_locals_command): Extract info print args and use them.
(info_args_command): Likewise.
(_initialize_stack): Modify on-line help.
* symtab.c (treg_matches_sym_type_name): New function.
(search_symbols): New arg t_regexp.
(symtab_symbol_info): New args quiet, regexp, t_regexp.
(info_variables_command): Extract info print args and use them.
(info_functions_command): Likewise.
(info_types_command): Update call to symtab_symbol_info.
(_initialize_symtab): Modify on-line help.
* symtab.h (treg_matches_sym_type_name): New function.
(search_symbols): New t_regexp arg.
Philippe Waroquiers [Sun, 1 Jul 2018 20:46:41 +0000 (22:46 +0200)]
New cli-utils.h/.c function extract_info_print_args
New cli-utils.h/.c function extract_info_print_args factorizes
the extraction of the args '[-q] [-t TYPEREGEXP] [NAMEREGEXP]'.
New cli-utils.h/.c function report_unrecognized_option_error
factorizes reporting an unknown option for a command.
These functions will be used by the commands
info [args|functions|locals|variables]
As extract_info_print_args will be used for 'info functions|variables' which
already have the NAMEREGEXP arg, it provides a backward compatible
behaviour.
cli-utils.c has a new static function extract_arg_maybe_quoted
that extracts an argument, possibly quoted. The behaviour of this
function is similar to the parsing done by gdb_argv.
gdb/ChangeLog
2018-10-27 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* cli-utils.c (extract_arg_maybe_quoted): New function.
(extract_info_print_args): New function.
(info_print_args_help): New function.
(report_unrecognized_option_error): New function.
* cli-utils.h (extract_arg_maybe_quoted): New function.
(extract_info_print_args): New function.
(info_print_args_help): New function.
(report_unrecognized_option_error): New function.
GDB Administrator [Sat, 27 Oct 2018 00:01:21 +0000 (00:01 +0000)]
Automatic date update in version.in
Tom Tromey [Sun, 14 Oct 2018 18:18:21 +0000 (12:18 -0600)]
Remove DEF_VECs from symtab.h
This removes a couple of DEF_VECs from symtab.h, replacing them with
std::vector at the points of use.
gdb/ChangeLog
2018-10-26 Tom Tromey <tom@tromey.com>
* dwarf2read.c (recursively_compute_inclusions): Use std::vector.
(compute_compunit_symtab_includes): Update.
* symtab.h: (symtab_ptr): Remove typedef. Don't define a VEC.
(compunit_symtab_ptr): Likewise.
John Baldwin [Fri, 26 Oct 2018 17:20:56 +0000 (10:20 -0700)]
Treat all unknown auxv tags on FreeBSD as unknown.
Previously, default_print_auxv_entry was called for any auxv entries
without a known AT_FREEBSD_* tag. However, this resulted in false
positive matches when FreeBSD added a new tag that has an existing
AT_* tag with a different meaning. Instead, only call
default_print_auxv_entry for specific tag values for which FreeBSD
matches the default AT_* values.
gdb/ChangeLog:
* fbsd-tdep.c (fbsd_print_auxv_entry): Only use
default_print_auxv_entry for specific tag values.
John Baldwin [Fri, 26 Oct 2018 17:20:56 +0000 (10:20 -0700)]
Support AT_HWCAP2 on FreeBSD.
include/ChangeLog:
* elf/common.h (AT_FREEBSD_HWCAP2): Define.
gdb/ChangeLog:
* fbsd-tdep.c (fbsd_print_auxv_entry): Handle AT_FREEBSD_HWCAP2.
Jim Wilson [Fri, 26 Oct 2018 17:32:58 +0000 (10:32 -0700)]
RISC-V: Linux signal frame support.
Add support for recognizing signal trampolines, parsing the signal frame,
and reading register values from it.
gdb/
* riscv-linux-tdep.c: Include tramp-frame.h and trad-frame.h.
(riscv_linux_sigframe_init): Declare.
(RISCV_INST_LI_A7_SIGRETURN, RISCV_INT_ECALL): New.
(riscv_linux_sigframe): New.
(SIGFRAME_SIGINFO_SIZE, UCONTEXT_MCONTEXT_OFFSET): New.
(riscv_linux_sigframe_init): Define.
(riscv_linux_init_abi): Call tramp_frame_prepend_unwinder.
Jim Wilson [Fri, 26 Oct 2018 17:29:46 +0000 (10:29 -0700)]
RISC-V: Linux signal frame support.
Make riscv_isa_flen available to the linux native code, and clean up duplicate
comments.
gdb/
* riscv-tdep.c (riscv_isa_xlen): Refer to riscv-tdep.h comment.
(riscv_isa_flen): Likewise. Drop static.
* riscv-tdep.h (riscv_isa_xlen): Move riscv-tdep.c comment to here.
(riscv_isa_flen): Likewise.
Edjunior Barbosa Machado [Fri, 26 Oct 2018 12:37:55 +0000 (09:37 -0300)]
[PowerPC] Add support for HTM registers
This patch adds support for Hardware Transactional Memory registers
for the powerpc linux native and core file targets, and for the
pwoerpc linux server stub.
These registers include both the HTM special-purpose registers (TFHAR,
TEXASR and TFIAR) as well as the set of registers that are
checkpointed (saved) when a transaction is initiated, which the
processor restores in the event of a transaction failure.
The set of checkpointed general-purpose registers is returned by the
linux kernel in the same format as the regular general-purpose
registers, defined in struct pt_regs. However, the architecture
specifies that only some of the registers present in pt_regs are
checkpointed (GPRs 0-31, CR, XER, LR and CTR). The kernel fills the
slots for MSR and NIP with other info. The other fields usually don't
have meaningful values. GDB doesn't define registers that are not
checkpointed in the architecture, but when generating a core file, GDB
fills the slot for the checkpointed MSR with the regular MSR. These
are usually similar, although some bits might be different, and in
some cases the checkpointed MSR will have a value of 0 in a
kernel-generated core-file. The checkpointed NIP is filled with TFHAR
by GDB in the core-file, which is what the kernel does. The other
fields are set to 0 by GDB.
Core files generated by the kernel have a note section for
checkpointed GPRs with the same size for both 32-bit and 64-bit
threads, and the values for the registers of a 32-bit thread are
squeezed in the first half, with no useful data in the second half.
GDB generates a smaller note section for 32-bit threads, but can read
both sizes.
The checkpointed XER is required to be 32-bit in the target
description documentation, even though the more recent ISAs define it
as 64-bit wide, since the high-order 32-bits are reserved, and because
in Linux there is no way to get a 64-bit checkpointed XER for 32-bit
threads. If this changes in the future, the target description
feature requirement can be relaxed to allow for a 64-bit checkpointed
XER.
Access to the checkpointed CR (condition register) can be confusing.
The architecture only specifies that CR fields 1 to 7 (the 24 least
significant bits) are checkpointed, but the kernel provides all 8
fields (32 bits). The value of field 0 is not masked by ptrace, so it
will sometimes show the result of some kernel operation, probably
treclaim., which sets this field.
The checkpointed registers are marked not to be saved and restored.
Inferior function calls during an active transaction don't work well,
and it's unclear what should be done in this case. TEXASR and TFIAR
can be altered asynchronously, during transaction failure recording,
so they are also not saved and restored. For consistency neither is
TFHAR.
Record and replay also doesn't work well when transactions are
involved. This patch doesn't address this, so the values of the HTM
SPRs will sometimes be innacurate when the record/relay target is
enabled. For instance, executing a "tbegin." alters TFHAR and TEXASR,
but these changes are not currently recorded.
Because the checkpointed registers are only available when a
transaction is active (or suspended), ptrace can return ENODATA when
gdb tries to read these registers and the inferior is not in a
transactional state. The registers are set to the unavailable state
when this happens. When gbd tries to write to one of these registers,
and it is unavailable, an error is raised.
The "fill" functions for checkpointed register sets in the server stub
are not implemented for the same reason as for the EBB register set,
since ptrace can also return ENODATA for checkpointed regsets. The
same issues with 'G' packets apply here.
Just like for the EBB registers, tracepoints will not mark the
checkpointed registers as unavailable if the inferior was not in a
transaction, so their content will also show 0 instead of
<unavailable> when inspecting trace data.
The new tests record the values of the regular registers before
stepping the inferior through a "tbegin." instruction to start a
transaction, then the checkpointed registers are checked against the
recorded pre-transactional values. New values are written to the
checkpointed registers and recorded, the inferior continues until the
transaction aborts (which is usually immediately when it is resumed),
and the regular registers are checked against the recorded values,
because the abort should have reverted the registers to these values.
Like for the EBB registers, target_store_registers will ignore the
checkpointed registers when called with -1 as the regno
argument (store all registers in one go).
gdb/ChangeLog:
2018-10-26 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* arch/ppc-linux-tdesc.h (tdesc_powerpc_isa207_htm_vsx32l)
(tdesc_powerpc_isa207_htm_vsx64l): Declare.
* arch/ppc-linux-common.h (PPC_LINUX_SIZEOF_TM_SPRREGSET)
(PPC32_LINUX_SIZEOF_CGPRREGSET, PPC64_LINUX_SIZEOF_CGPRREGSET)
(PPC_LINUX_SIZEOF_CFPRREGSET, PPC_LINUX_SIZEOF_CVMXREGSET)
(PPC_LINUX_SIZEOF_CVSXREGSET, PPC_LINUX_SIZEOF_CPPRREGSET)
(PPC_LINUX_SIZEOF_CDSCRREGSET, PPC_LINUX_SIZEOF_CTARREGSET):
Define.
(struct ppc_linux_features) <htm>: New field.
(ppc_linux_no_features): Add initializer for htm field.
* arch/ppc-linux-common.c (ppc_linux_match_description): Return
new tdescs.
* nat/ppc-linux.h (PPC_FEATURE2_HTM, NT_PPC_TM_CGPR)
(NT_PPC_TM_CFPR, NT_PPC_TM_CVMX, NT_PPC_TM_CVSX)
(NT_PPC_TM_SPR, NT_PPC_TM_CTAR, NT_PPC_TM_CPPR, NT_PPC_TM_CDSCR):
Define if not already defined.
* features/Makefile (WHICH): Add rs6000/powerpc-isa207-htm-vsx32l
and rs6000/powerpc-isa207-htm-vsx64l.
(XMLTOC): Add rs6000/powerpc-isa207-htm-vsx32l.xml and
rs6000/powerpc-isa207-htm-vsx64l.xml.
* features/rs6000/power-htm-spr.xml: New file.
* features/rs6000/power-htm-core.xml: New file.
* features/rs6000/power64-htm-core.xml: New file.
* features/rs6000/power-htm-fpu.xml: New file.
* features/rs6000/power-htm-altivec.xml: New file.
* features/rs6000/power-htm-vsx.xml: New file.
* features/rs6000/power-htm-ppr.xml: New file.
* features/rs6000/power-htm-dscr.xml: New file.
* features/rs6000/power-htm-tar.xml: New file.
* features/rs6000/powerpc-isa207-htm-vsx32l.xml: New file.
* features/rs6000/powerpc-isa207-htm-vsx64l.xml: New file.
* features/rs6000/powerpc-isa207-htm-vsx32l.c: Generate.
* features/rs6000/powerpc-isa207-htm-vsx64l.c: Generate.
* regformats/rs6000/powerpc-isa207-htm-vsx32l.dat: Generate.
* regformats/rs6000/powerpc-isa207-htm-vsx64l.dat: Generate.
* ppc-linux-nat.c (fetch_register, fetch_ppc_registers): Call
fetch_regset with HTM regsets.
(store_register, store_ppc_registers): Call store_regset with HTM
regsets.
(ppc_linux_nat_target::read_description): Set htm field in the
features struct if needed.
* ppc-linux-tdep.c: Include
features/rs6000/powerpc-isa207-htm-vsx32l.c and
features/rs6000/powerpc-isa207-htm-vsx64l.c.
(ppc32_regmap_tm_spr, ppc32_regmap_cgpr, ppc64_le_regmap_cgpr)
(ppc64_be_regmap_cgpr, ppc32_regmap_cfpr, ppc32_le_regmap_cvmx)
(ppc32_be_regmap_cvmx, ppc32_regmap_cvsx, ppc32_regmap_cppr)
(ppc32_regmap_cdscr, ppc32_regmap_ctar): New globals.
(ppc32_linux_tm_sprregset, ppc32_linux_cgprregset)
(ppc64_be_linux_cgprregset, ppc64_le_linux_cgprregset)
(ppc32_linux_cfprregset, ppc32_le_linux_cvmxregset)
(ppc32_be_linux_cvmxregset, ppc32_linux_cvsxregset)
(ppc32_linux_cpprregset, ppc32_linux_cdscrregset)
(ppc32_linux_ctarregset): New globals.
(ppc_linux_cgprregset, ppc_linux_cvmxregset): New functions.
(ppc_linux_collect_core_cpgrregset): New function.
(ppc_linux_iterate_over_regset_sections): Call back with the htm
regsets.
(ppc_linux_core_read_description): Check if the tm spr section is
present and set htm in the features struct.
(_initialize_ppc_linux_tdep): Call
initialize_tdesc_powerpc_isa207_htm_vsx32l and
initialize_tdesc_powerpc_isa207_htm_vsx64l.
* ppc-linux-tdep.h (ppc_linux_cgprregset, ppc_linux_cvmxregset):
Declare.
(ppc32_linux_tm_sprregset, ppc32_linux_cfprregset)
(ppc32_linux_cvsxregset, ppc32_linux_cpprregset)
(ppc32_linux_cdscrregset, ppc32_linux_ctarregset): Declare.
* ppc-tdep.h (struct gdbarch_tdep) <have_htm_spr, have_htm_core>:
New fields.
<have_htm_fpu, have_htm_altivec, have_htm_vsx>:
Likewise.
<ppc_cppr_regnum, ppc_cdscr_regnum, ppc_ctar_regnum>: Likewise.
<ppc_cdl0_regnum, ppc_cvsr0_regnum, ppc_cefpr0_regnum>: Likewise.
(enum) <PPC_TFHAR_REGNUM, PPC_TEXASR_REGNUM, PPC_TFIAR_REGNUM>:
New enum fields.
<PPC_CR0_REGNUM, PPC_CCR_REGNUM, PPC_CXER_REGNUM>: Likewise.
<PPC_CLR_REGNUM, PPC_CCTR_REGNUM, PPC_CF0_REGNUM>: Likewise.
<PPC_CFPSCR_REGNUM, PPC_CVR0_REGNUM, PPC_CVSCR_REGNUM>: Likewise.
<PPC_CVRSAVE_REGNUM, PPC_CVSR0_UPPER_REGNUM>: Likewise.
<PPC_CPPR_REGNUM, PPC_CDSCR_REGNUM>: Likewise.
<PPC_CTAR_REGNUM>: Likewise.
(PPC_IS_TMSPR_REGNUM, PPC_IS_CKPTGP_REGNUM, PPC_IS_CKPTFP_REGNUM)
(PPC_IS_CKPTVMX_REGNUM, PPC_IS_CKPTVSX_REGNUM): Define.
* rs6000-tdep.c (IS_CDFP_PSEUDOREG, IS_CVSX_PSEUDOREG)
(IS_CEFP_PSEUDOREG): Define.
(rs6000_register_name): Hide the upper halves of checkpointed VSX
registers. Return names for the checkpointed DFP, VSX, and EFP
pseudo registers.
(rs6000_pseudo_register_type): Remove initial assert and raise an
internal error in the else clause instead. Return types for the
checkpointed DFP, VSX, and EFP pseudo registers.
(dfp_pseudo_register_read, dfp_pseudo_register_write): Handle
checkpointed DFP pseudo registers.
(vsx_pseudo_register_read, vsx_pseudo_register_write): Handle
checkpointed VSX pseudo registers.
(efp_pseudo_register_read, efp_pseudo_register_write): Rename
from efpr_pseudo_register_read and
efpr_pseudo_register_write. Handle checkpointed EFP pseudo
registers.
(rs6000_pseudo_register_read, rs6000_pseudo_register_write):
Handle checkpointed DFP, VSX, and EFP registers.
(dfp_ax_pseudo_register_collect, vsx_ax_pseudo_register_collect)
(efp_ax_pseudo_register_collect): New functions.
(rs6000_ax_pseudo_register_collect): Move DFP, VSX and EFP pseudo
register logic to new functions. Handle checkpointed DFP, VSX,
and EFP pseudo registers.
(rs6000_gdbarch_init): Look for and validate the htm features.
Include checkpointed DFP, VSX and EFP pseudo-registers.
* NEWS: Mention access to PPR, DSCR, TAR, EBB/PMU registers and
HTM registers.
gdb/gdbserver/ChangeLog:
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* configure.srv (ipa_ppc_linux_regobj): Add
powerpc-isa207-htm-vsx32l-ipa.o and
powerpc-isa207-htm-vsx64l-ipa.o.
(powerpc*-*-linux*): Add powerpc-isa207-htm-vsx32l.o and
powerpc-isa207-htm-vsx64l.o to srv_regobj. Add
rs6000/power-htm-spr.xml, rs6000/power-htm-core.xml,
rs6000/power64-htm-core.xml, rs6000/power-htm-fpu.xml,
rs6000/power-htm-altivec.xml, rs6000/power-htm-vsx.xml,
rs6000/power-htm-ppr.xml, rs6000/power-htm-dscr.xml,
rs6000/power-htm-tar.xml, rs6000/powerpc-isa207-htm-vsx32l.xml,
and rs6000/powerpc-isa207-htm-vsx64l.xml to srv_xmlfiles.
* linux-ppc-tdesc-init.h (enum ppc_linux_tdesc)
<PPC_TDESC_ISA207_HTM_VSX>: New enum value.
(init_registers_powerpc_isa207_htm_vsx32l)
(init_registers_powerpc_isa207_htm_vsx64l): Declare.
* linux-ppc-low.c (ppc_fill_tm_sprregset, ppc_store_tm_sprregset)
(ppc_store_tm_cgprregset, ppc_store_tm_cfprregset)
(ppc_store_tm_cvrregset, ppc_store_tm_cvsxregset)
(ppc_store_tm_cpprregset, ppc_store_tm_cdscrregset)
(ppc_store_tm_ctarregset): New functions.
(ppc_regsets): Add entries for HTM regsets.
(ppc_arch_setup): Set htm in features struct when needed. Set
sizes for the HTM regsets.
(ppc_get_ipa_tdesc_idx): Return PPC_TDESC_ISA207_HTM_VSX.
(initialize_low_arch): Call
init_registers_powerpc_isa207_htm_vsx32l and
init_registers_powerpc_isa207_htm_vsx64l.
* linux-ppc-ipa.c (get_ipa_tdesc): Handle
PPC_TDESC_ISA207_HTM_VSX.
(initialize_low_tracepoint): Call
init_registers_powerpc_isa207_htm_vsx32l and
init_registers_powerpc_isa207_htm_vsx64l.
gdb/testsuite/ChangeLog:
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* gdb.arch/powerpc-htm-regs.c: New file.
* gdb.arch/powerpc-htm-regs.exp: New file.
gdb/doc/ChangeLog:
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* gdb.texinfo (PowerPC Features): Describe new features
"org.gnu.gdb.power.htm.spr", "org.gnu.gdb.power.htm.core",
"org.gnu.gdb.power.htm.fpu", "org.gnu.gdb.power.htm.altivec",
"org.gnu.gdb.power.htm.vsx", "org.gnu.gdb.power.htm.ppr",
"org.gnu.gdb.power.htm.dscr", "org.gnu.gdb.power.htm.tar".
Pedro Franco de Carvalho [Fri, 26 Oct 2018 12:37:55 +0000 (09:37 -0300)]
[PowerPC] Reject tdescs with VSX and no FPU or Altivec
Currently rs6000_gdbarch_init will accept a tdesc with the
"org.gnu.gdb.power.vsx" feature but without the
"org.gnu.gdb.power.altivec" or "org.gnu.gdb.power.fpu".
It isn't clear from the standard features documentation that these are
requirements. However, these tdescs would cause trouble in the VSX
pseudo-register functions, so this patch will cause them to be
rejected.
gdb/ChangeLog:
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* rs6000-tdep.c (rs6000_gdbarch_init): Reject tdescs with vsx but
without altivec or fpu.
Edjunior Barbosa Machado [Fri, 26 Oct 2018 12:37:54 +0000 (09:37 -0300)]
[PowerPC] Add support for EBB and PMU registers
This patch adds support for registers of the Event Based Branching and
Performance Monitoring Units for the powerpc linux native and core
file targets, and for the powerpc linux server stub.
All three EBB registers are accessible. Only a subset of the PMU
registers can be accessed through ptrace. Because of this, the PMU
registers are enumerated individually in gdbarch_tdep, as opposed to
having a single "have_pmu" flag. This is intended to make it easier
to add additional PMU registers in the future, since checking a
"have_pmu" flag elsewhere in the code would no longer be correct. The
tdesc feature is named org.gnu.gdb.power.linux.pmu because of this.
It's unclear if it makes sense to save and restore these registers
across function calls, since some of them can be modified
asynchronously. They are also not tracked in record-replay mode.
The kernel can return ENODATA when ptrace is used to get the EBB
registers, unless a linux performance event that uses EBB is open in
the inferior. For this reason, the "fill" functions in the server
stub for the ebb register sets is not implemented.
Since gdbserver writes all registers in one go before resuming the
inferior, this error would not be detected at the time the user tries
to write to one of the registers on the client side, and gdbserver
would print out warnings every time it resumes the inferior when no
ebb performance event is opened, so there is currently no
straightforward way to handle this case. This means the ebb registers
in the client-side regcache can become dirty when the user tries to
write to them, until the inferior is resumed and stopped again.
A related issue is that 'G' packets used to write to unrelated
registers will include bad data for the EBB registers if they are
unavailable, since no register status information is included in the
'G' packet. This data won't be written to the inferior by the
gdbserver stub because the "fill" functions are not implemented, and
currently the gdbserver stub doesn't change the status of the
registers in its own regcache in response to 'G' packets.
Another limitation for the ebb registers is that traceframes don't
record if registers are available or not, so if these registers are
collected when a tracepoint is hit and the inferior has no ebb event
opened, the user will see zero values for all of them, instead of the
usual <unavailable>.
Because these registers are often unavailable, trying to store them
with target_store_registers with -1 for the regno argument (all
registers) would almost always fail, so they are ignored in this case.
gdb/ChangeLog:
2018-10-26 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* arch/ppc-linux-common.h (PPC_LINUX_SIZEOF_EBBREGSET)
(PPC_LINUX_SIZEOF_PMUREGSET): Declare.
* nat/ppc-linux.h (PPC_FEATURE2_EBB, NT_PPC_EBB, NT_PPC_PMU):
Define if not already defined.
* features/rs6000/power-ebb.xml: New file.
* features/rs6000/power-linux-pmu.xml: New file.
* features/rs6000/powerpc-isa207-vsx32l.xml: Include ebb and pmu
features.
* features/rs6000/powerpc-isa207-vsx64l.xml: Likewise.
* features/rs6000/powerpc-isa207-vsx32l.c: Re-generate.
* features/rs6000/powerpc-isa207-vsx64l.c: Re-generate.
* regformats/rs6000/powerpc-isa207-vsx32l.dat: Re-generate.
* regformats/rs6000/powerpc-isa207-vsx64l.dat: Re-generate.
* ppc-linux-nat.c (fetch_register, fetch_ppc_registers): Call
fetch_regset with ebb and pmu regsets.
(store_register, store_ppc_registers): Call store_regset with ebb
and pmu regsets.
(ppc_linux_nat_target::read_description): Set isa207 field in the
features struct if ebb and pmu are avaiable.
* ppc-linux-tdep.c (ppc32_regmap_ebb, ppc32_regmap_pmu)
(ppc32_linux_ebbregset, ppc32_linux_pmuregset): New globals.
(ppc_linux_iterate_over_regset_sections): Call back with the ebb
and pmu regsets.
(ppc_linux_core_read_description): Check if the pmu section is
present and set isa207 in the features struct.
* ppc-linux-tdep.h (ppc32_linux_ebbregset)
(ppc32_linux_pmuregset): Declare.
* ppc-tdep.h (struct gdbarch_tdep) <ppc_mmcr0_regnum>: New field.
<ppc_mmcr2_regnum, ppc_siar_regnum, ppc_sdar_regnum>: New fields.
<ppc_sier_regnum>: New field.
(enum): <PPC_BESCR_REGNUM, PPC_EBBHR_REGNUM, PPC_EBBRR_REGNUM>:
New enum values.
<PPC_MMCR0_REGNUM, PPC_MMCR2_REGNUM, PPC_SIAR_REGNUM>: New enum
values.
<PPC_SDAR_REGNUM, PPC_SIER_REGNUM>: New enum values.
(PPC_IS_EBB_REGNUM, PPC_IS_PMU_REGNUM): Define.
* rs6000-tdep.c (rs6000_gdbarch_init): Look for and validate the
ebb and pmu features.
gdb/gdbserver/ChangeLog:
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* configure.srv (powerpc*-*-linux*): Add rs6000/power-ebb.xml and
rs6000/power-linux-pmu.xml to srv_xmlfiles.
* linux-ppc-low.c (ppc_store_ebbregset, ppc_fill_pmuregset)
(ppc_store_pmuregset): New functions.
(ppc_regsets): Add entries for ebb and pmu regsets.
(ppc_arch_setup): Set isa207 in features struct if the ebb and
pmu regsets are available. Set sizes for these regsets.
gdb/doc/ChangeLog:
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* gdb.texinfo (PowerPC Features): Describe new features
"org.gnu.gdb.power.ebb" and "org.gnu.gdb.power.linux.pmu".
Edjunior Barbosa Machado [Fri, 26 Oct 2018 12:37:54 +0000 (09:37 -0300)]
[PowerPC] Add support for TAR
This patch adds support for the Target Address Register for powerpc
linux native and core file targets, and in the powerpc linux server
stub.
gdb/ChangeLog:
2018-10-26 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* arch/ppc-linux-tdesc.h (tdesc_powerpc_isa207_vsx32l)
(tdesc_powerpc_isa207_vsx64l): Declare.
* arch/ppc-linux-common.h (PPC_LINUX_SIZEOF_TARREGSET): Define.
(struct ppc_linux_features) <isa207>: New field.
(ppc_linux_no_features): Add initializer for isa207 field.
* arch/ppc-linux-common.c (ppc_linux_match_description): Return
new tdescs.
* nat/ppc-linux.h (PPC_FEATURE2_ARCH_2_07, PPC_FEATURE2_TAR)
(NT_PPC_TAR): Define if not already defined.
* features/Makefile (WHICH): Add rs6000/powerpc-isa207-vsx32l and
rs6000/powerpc-isa207-vsx64l.
(XMLTOC): Add rs6000/powerpc-isa207-vsx32l.xml and
rs6000/powerpc-isa207-vsx64l.xml.
* features/rs6000/power-tar.xml: New file.
* features/rs6000/powerpc-isa207-vsx32l.xml: New file.
* features/rs6000/powerpc-isa207-vsx64l.xml: New file.
* features/rs6000/powerpc-isa207-vsx32l.c: Generate.
* features/rs6000/powerpc-isa207-vsx64l.c: Generate.
* regformats/rs6000/powerpc-isa207-vsx32l.dat: Generate.
* regformats/rs6000/powerpc-isa207-vsx64l.dat: Generate.
* ppc-linux-nat.c (fetch_register, fetch_ppc_registers): Call
fetch_regset with the TAR regset.
(store_register, store_ppc_registers): Call store_regset with the
TAR regset.
(ppc_linux_nat_target::read_description): Set isa207 field in the
features struct if needed.
* ppc-linux-tdep.c: Include
features/rs6000/powerpc-isa207-vsx32l.c and
features/rs6000/powerpc-isa207-vsx64l.c.
(ppc32_regmap_tar, ppc32_linux_tarregset): New globals.
(ppc_linux_iterate_over_regset_sections): Call back with the tar
regset.
(ppc_linux_core_read_description): Check if the tar section is
present and set isa207 in the features struct.
(_initialize_ppc_linux_tdep): Call
initialize_tdesc_powerpc_isa207_vsx32l and
initialize_tdesc_powerpc_isa207_vsx64l.
* ppc-linux-tdep.h (ppc32_linux_tarregset): Declare.
* ppc-tdep.h (gdbarch_tdep) <ppc_tar_regnum>: New field.
(enum) <PPC_TAR_REGNUM>: New enum value.
* rs6000-tdep.c (rs6000_gdbarch_init): Look for and validate tar
feature.
(ppc_process_record_op31): Record changes to TAR.
gdb/gdbserver/ChangeLog:
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* configure.srv (ipa_ppc_linux_regobj): Add
powerpc-isa207-vsx64l-ipa.o and powerpc-isa207-vsx32l-ipa.o.
(powerpc*-*-linux*): Add powerpc-isa207-vsx32l.o and
powerpc-isa207-vsx64l.o to srv_regobj, add rs6000/power-tar.xml,
rs6000/powerpc-isa207-vsx32l.xml, and
rs6000/powerpc-isa207-vsx64l.xml to srv_xmlfiles.
* linux-ppc-tdesc-init.h (enum ppc_linux_tdesc)
<PPC_TDESC_ISA207_VSX>: New enum value.
(init_registers_powerpc_isa207_vsx32l): Declare.
(init_registers_powerpc_isa207_vsx64l): Declare.
* linux-ppc-low.c (ppc_fill_tarregset): New function.
(ppc_store_tarregset): New function.
(ppc_regsets): Add entry for the TAR regset.
(ppc_arch_setup): Set isa207 in features struct when needed. Set
size for the TAR regsets.
(ppc_get_ipa_tdesc_idx): Return PPC_TDESC_ISA207_VSX.
(initialize_low_arch): Call init_registers_powerpc_isa207_vsx32l
and init_registers_powerpc_isa207_vsx64l.
* linux-ppc-ipa.c (get_ipa_tdesc): Handle PPC_TDESC_ISA207_VSX.
(initialize_low_tracepoint): Call
init_registers_powerpc_isa207_vsx32l and
init_registers_powerpc_isa207_vsx64l.
gdb/testsuite/ChangeLog:
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* gdb.arch/powerpc-tar.c: New file.
* gdb.arch/powerpc-tar.exp: New file.
gdb/doc/ChangeLog:
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* gdb.texinfo (PowerPC Features): Describe new feature
"org.gnu.gdb.power.tar".
Edjunior Barbosa Machado [Fri, 26 Oct 2018 12:37:54 +0000 (09:37 -0300)]
[PowerPC] Add support for PPR and DSCR
This patch adds gdb support for the Program Priorty Register and the
Data Stream Control Register, for the powerpc linux native and core
file targets, and for the powerpc linux server stub.
gdb/ChangeLog:
2018-10-26 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* arch/ppc-linux-tdesc.h (tdesc_powerpc_isa205_ppr_dscr_vsx32l)
(tdesc_powerpc_isa205_ppr_dscr_vsx64l): Declare.
* arch/ppc-linux-common.h (PPC_LINUX_SIZEOF_PPRREGSET)
(PPC_LINUX_SIZEOF_DSCRREGSET): Define.
(struct ppc_linux_features) <ppr_dscr>: New field.
(ppc_linux_no_features): Add initializer for ppr_dscr field.
* arch/ppc-linux-common.c (ppc_linux_match_description): Return
new tdescs.
* nat/ppc-linux.h (PPC_FEATURE2_DSCR, NT_PPC_PPR, NT_PPC_DSCR):
Define if not already defined.
* features/Makefile (WHICH): Add
rs6000/powerpc-isa205-ppr-dscr-vsx32l and
rs6000/powerpc-isa205-ppr-dscr-vsx64l.
(XMLTOC): Add rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml and
rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml.
* features/rs6000/power-dscr.xml: New file.
* features/rs6000/power-ppr.xml: New file.
* features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml: New file.
* features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml: New file.
* features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.c: Generate.
* features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.c: Generate.
* regformats/rs6000/powerpc-isa205-ppr-dscr-vsx32l.dat: Generate.
* regformats/rs6000/powerpc-isa205-ppr-dscr-vsx64l.dat: Generate.
* ppc-linux-nat.c: Include <sys/uio.h>.
(fetch_regset, store_regset, check_regset): New functions.
(fetch_register, fetch_ppc_registers): Call fetch_regset with
DSCR and PPR regsets.
(store_register, store_ppc_registers): Call store_regset with
DSCR and PPR regsets.
(ppc_linux_get_hwcap2): New function.
(ppc_linux_nat_target::read_description): Call
ppc_linux_get_hwcap2 and check_regset, set ppr_dscr field in the
features struct if needed.
* ppc-linux-tdep.c: Include
features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.c and
features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.c.
(ppc32_regmap_ppr, ppc32_regmap_dscr, ppc32_linux_pprregset)
(ppc32_linux_dscrregset): New globals.
(ppc_linux_iterate_over_regset_sections): Call back with the ppr
and dscr regsets.
(ppc_linux_core_read_description): Check if the ppr and dscr
sections are present and set ppr_dscr in the features struct.
(_initialize_ppc_linux_tdep): Call
initialize_tdesc_powerpc_isa205_ppr_dscr_vsx32l and
initialize_tdesc_powerpc_isa205_ppr_dscr_vsx64l.
* ppc-linux-tdep.h (ppc32_linux_pprregset)
(ppc32_linux_dscrregset): Declare.
* ppc-tdep.h (struct gdbarch_tdep) <ppc_ppr_regnum>: New field.
<ppc_dscr_regnum>: New field.
(enum) <PPC_PPR_REGNUM, PPC_DSCR_REGNUM>: New enum values.
* rs6000-tdep.c (rs6000_gdbarch_init): Look for and validate ppr
and dscr features.
(ppc_process_record_op31): Record changes to PPR and DSCR.
gdb/gdbserver/ChangeLog:
2018-10-26 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* configure.srv (ipa_ppc_linux_regobj): Add
powerpc-isa205-ppr-dscr-vsx32l-ipa.o and
powerpc-isa205-ppr-dscr-vsx64l-ipa.o.
(powerpc*-*-linux*): Add powerpc-isa205-ppr-dscr-vsx32l.o and
powerpc-isa205-ppr-dscr-vsx64l.o to srv_regobj, add
rs6000/power-dscr.xml, rs6000/power-ppr.xml,
rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml and
rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml to srv_xmlfiles.
* linux-ppc-tdesc-init.h (enum ppc_linux_tdesc)
<PPC_TDESC_ISA205_PPR_DSCR_VSX>: New enum value.
(init_registers_powerpc_isa205_ppr_dscr_vsx32l)
(init_registers_powerpc_isa205_ppr_dscr_vsx64l): Declare.
* linux-ppc-low.c: Include "elf/common.h" and <sys/uio.h>.
(ppc_hwcap): Add comment.
(ppc_hwcap2): New global.
(ppc_check_regset, ppc_fill_pprregset, ppc_store_pprregset)
(ppc_fill_dscrregset, ppc_store_dscrregset): New functions.
(ppc_regsets): Add entries for the DSCR and PPR regsets.
(ppc_arch_setup): Get AT_HWCAP2. Set ppr_dscr in features struct
when needed. Set sizes for the the DSCR and PPR regsets.
(ppc_get_ipa_tdesc_idx): Return PPC_TDESC_ISA205_PPR_DSCR_VSX.
(initialize_low_arch): Call
init_registers_powerpc_isa205_ppr_dscr_vsx32l and
init_registers_powerpc_isa205_ppr_dscr_vsx64l.
* linux-ppc-ipa.c (get_ipa_tdesc): Handle
PPC_TDESC_ISA205_PPR_DSCR_VSX.
(initialize_low_tracepoint): Call
init_registers_powerpc_isa205_ppr_dscr_vsx32l and
init_registers_powerpc_isa205_ppr_dscr_vsx64l.
gdb/testsuite/ChangeLog:
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* gdb.arch/powerpc-ppr-dscr.c: New file.
* gdb.arch/powerpc-ppr-dscr.exp: New file.
gdb/doc/ChangeLog:
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* gdb.texinfo (PowerPC Features): Describe new features
"org.gnu.gdb.power.ppr" and "org.gnu.gdb.power.dscr".
Pedro Franco de Carvalho [Fri, 26 Oct 2018 12:37:54 +0000 (09:37 -0300)]
[PowerPC] Refactor have_ initializers in rs6000-tdep.c
This patch refactors a series of initializers in rs6000_gdbarch_init
for clarity. The have_fpu initializer is also changed to set the
variable to 0, like the other similar variables. This doesn't affect
program behavior.
gdb/ChangeLog:
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* rs6000-tdep.c (rs6000_gdbarch_init): Replace line wrapping by a
second initializer line for the have_* variables. Initialize
have_fpu to 0 instead of 1.
Pedro Franco de Carvalho [Fri, 26 Oct 2018 12:37:54 +0000 (09:37 -0300)]
[PowerPC] Fix indentation in arch/ppc-linux-common.c
This patch parenthesizes the tdesc selection expressions in
arch/ppc-linux-common.c so that they can be tab-indented.
gdb/ChangeLog:
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* arch/ppc-linux-common.c (ppc_linux_match_description):
Parenthesize tdesc assignements and indent them properly.