deliverable/binutils-gdb.git
4 years ago[readline] Fix heap-buffer-overflow in update_line
Tom de Vries [Fri, 12 Jul 2019 07:53:02 +0000 (09:53 +0200)] 
[readline] Fix heap-buffer-overflow in update_line

When:
- building trunk gdb with '-fsanitize=address -lasan',
- running gdb tests with "export ASAN_OPTIONS=detect_leaks=0",
I run into a heap-buffer-overflow failure for
gdb.base/utf8-identifiers.exp.

In more detail, the libasan error report looks like this:
...
=================================================================
==22340==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x619000054a80 at pc 0x7fcd0306b4c9 bp 0x7fffb1a8d880 sp 0x7fffb1a8d030
READ of size 32766 at 0x619000054a80 thread T0
    #0 0x7fcd0306b4c8  (/usr/lib64/libasan.so.4+0xae4c8)
    #1 0x15f12a1 in update_line
/data/gdb_versions/devel/src/readline/display.c:1377
    #2 0x15f03cb in rl_redisplay
/data/gdb_versions/devel/src/readline/display.c:1204
    #3 0x15bf932 in readline_internal_setup
/data/gdb_versions/devel/src/readline/readline.c:394
    #4 0x15fe723 in _rl_callback_newline
/data/gdb_versions/devel/src/readline/callback.c:89
    #5 0x15fe7ef in rl_callback_handler_install
/data/gdb_versions/devel/src/readline/callback.c:102
    #6 0xd7bce6 in gdb_rl_callback_handler_install(char const*)
/data/gdb_versions/devel/src/gdb/event-top.c:319
    #7 0xd7c0c6 in display_gdb_prompt(char const*)
/data/gdb_versions/devel/src/gdb/event-top.c:409
    #8 0xd7d6c1 in command_line_handler(std::unique_ptr<char,
gdb::xfree_deleter<char> >&&)
/data/gdb_versions/devel/src/gdb/event-top.c:776
    #9 0xd7b92a in gdb_rl_callback_handler
/data/gdb_versions/devel/src/gdb/event-top.c:217
    #10 0x15ff479 in rl_callback_read_char
/data/gdb_versions/devel/src/readline/callback.c:220
    #11 0xd7b4d5 in gdb_rl_callback_read_char_wrapper_noexcept
/data/gdb_versions/devel/src/gdb/event-top.c:175
    #12 0xd7b6b5 in gdb_rl_callback_read_char_wrapper
/data/gdb_versions/devel/src/gdb/event-top.c:192
    #13 0xd7c8aa in stdin_event_handler(int, void*)
/data/gdb_versions/devel/src/gdb/event-top.c:514
    #14 0xd76ca7 in handle_file_event
/data/gdb_versions/devel/src/gdb/event-loop.c:731
    #15 0xd7751f in gdb_wait_for_event
/data/gdb_versions/devel/src/gdb/event-loop.c:857
    #16 0xd7547e in gdb_do_one_event()
/data/gdb_versions/devel/src/gdb/event-loop.c:321
    #17 0xd75526 in start_event_loop()
/data/gdb_versions/devel/src/gdb/event-loop.c:370
    #18 0x101b04c in captured_command_loop
/data/gdb_versions/devel/src/gdb/main.c:331
    #19 0x101de73 in captured_main
/data/gdb_versions/devel/src/gdb/main.c:1173
    #20 0x101df03 in gdb_main(captured_main_args*)
/data/gdb_versions/devel/src/gdb/main.c:1188
    #21 0x872dba in main /data/gdb_versions/devel/src/gdb/gdb.c:32
    #22 0x7fcd00f2ff49 in __libc_start_main (/lib64/libc.so.6+0x20f49)
    #23 0x872bc9 in _start (/data/gdb_versions/devel/build/gdb/gdb+0x872bc9)

0x619000054a80 is located 0 bytes to the right of 1024-byte region
[0x619000054680,0x619000054a80)
allocated by thread T0 here:
    #0 0x7fcd03099510 in malloc (/usr/lib64/libasan.so.4+0xdc510)
    #1 0xae0078 in xmalloc
/data/gdb_versions/devel/src/gdb/common/common-utils.c:44
    #2 0x15eaccb in init_line_structures
/data/gdb_versions/devel/src/readline/display.c:458
    #3 0x15eb4d8 in rl_redisplay
/data/gdb_versions/devel/src/readline/display.c:526
    #4 0x15bf932 in readline_internal_setup
/data/gdb_versions/devel/src/readline/readline.c:394
    #5 0x15fe723 in _rl_callback_newline
/data/gdb_versions/devel/src/readline/callback.c:89
    #6 0x15fe7ef in rl_callback_handler_install
/data/gdb_versions/devel/src/readline/callback.c:102
    #7 0xd7bce6 in gdb_rl_callback_handler_install(char const*)
/data/gdb_versions/devel/src/gdb/event-top.c:319
    #8 0xd7c0c6 in display_gdb_prompt(char const*)
/data/gdb_versions/devel/src/gdb/event-top.c:409
    #9 0xaa041b in cli_interp_base::pre_command_loop()
/data/gdb_versions/devel/src/gdb/cli/cli-interp.c:286
    #10 0xf5342a in interp_pre_command_loop(interp*)
/data/gdb_versions/devel/src/gdb/interps.c:320
    #11 0x101b047 in captured_command_loop
/data/gdb_versions/devel/src/gdb/main.c:328
    #12 0x101de73 in captured_main
/data/gdb_versions/devel/src/gdb/main.c:1173
    #13 0x101df03 in gdb_main(captured_main_args*)
/data/gdb_versions/devel/src/gdb/main.c:1188
    #14 0x872dba in main /data/gdb_versions/devel/src/gdb/gdb.c:32
    #15 0x7fcd00f2ff49 in __libc_start_main (/lib64/libc.so.6+0x20f49)

SUMMARY: AddressSanitizer: heap-buffer-overflow
(/usr/lib64/libasan.so.4+0xae4c8)
Shadow bytes around the buggy address:
  0x0c3280002900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c3280002910: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c3280002920: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c3280002930: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c3280002940: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c3280002950:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c3280002960: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c3280002970: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c3280002980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c3280002990: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c32800029a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==22340==ABORTING
...

I've written an assert in rl_redisplay that formulates the error condition:
...
@@ -1387,6 +1389,10 @@ rl_redisplay (void)
          cpos_adjusted = 0;
+         assert (last_lmargin + (_rl_screenwidth + visible_wrap_offset)
+                 <= line_size);
+         assert (lmargin + (_rl_screenwidth + (lmargin ? 0 : wrap_offset))
+                 <= line_size);
          update_line (&visible_line[last_lmargin],
                       &invisible_line[lmargin],
                       0,
                       _rl_screenwidth + visible_wrap_offset,
                       _rl_screenwidth + (lmargin ? 0 : wrap_offset),
                       0);
...
which triggers without needing the address sanitizer (or even an executable),
like this:
...
$ TERM=dumb gdb -q -ex "set width 0"
gdb: src/display.c:1393: rl_redisplay: Assertion
`last_lmargin + (_rl_screenwidth + visible_wrap_offset) <= line_size'
failed.
Aborted (core dumped)
...

The basic problem is this: visible_line and invisible_line have length
line_size, but the update_line call assumes that line_size is at least
_rl_screenwidth + 1.  Executing "set width 0" sets _rl_screenwidth to 32766 but
doesn't affect line_size, which is initialized to 1024.

Fix this by ensuring in init_line_structures and rl_redisplay that line_size
is at least _rl_screenwidth + 1.

Tested on x86_64-linux.

Reviewed by readline maintainer (
https://sourceware.org/ml/gdb-patches/2019-05/msg00566.html ).

readline/ChangeLog.gdb:

2019-07-12  Tom de Vries  <tdevries@suse.de>
    Chet Ramey  <chet.ramey@case.edu>

PR cli/24514
* readline/display.c (init_line_structures, rl_redisplay): Ensure
line_size is at least _rl_screenwidth + 1.

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 12 Jul 2019 00:00:19 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agogdb: Add command completers for some info commands
Andrew Burgess [Thu, 11 Jul 2019 14:39:55 +0000 (15:39 +0100)] 
gdb: Add command completers for some info commands

Add command completion for info variables, functions, args, and
locals.  This completer only completes the command line options as
these commands all take a regexp which GDB can't really offer
completions for.

gdb/ChangeLog:

* cli/cli-utils.c (info_print_command_completer): New function.
* cli/cli-utils.h: Add 'completer.h' include, and forward
declaration for 'struct cmd_list_element'.
(info_print_command_completer): Declare.
* stack.c (_initialize_stack): Add completer for 'info locals' and
'info args'.
* symtab.c (_initialize_symtab): Add completer for 'info
variables' and 'info functions'.
* NEWS: Mention completion for additional info commands.

4 years agogdb: Make use of gdb::option framework for some info commands
Andrew Burgess [Wed, 10 Jul 2019 21:52:38 +0000 (22:52 +0100)] 
gdb: Make use of gdb::option framework for some info commands

Update the 'info variables', 'info functions', 'info locals', and
'info args' commands to make use of the gdb::options framework.

There should be no user visible changes after this commit as I have
left the help text generation using the existing mechanism, which
already tries to customise the text for each of the commands.

gdb/ChangeLog:

* cli/cli-utils.c (extract_info_print_args): Delete.
(extract_arg_maybe_quoted): Delete.
(info_print_options_defs): New variable.
(make_info_print_options_def_group): New function.
(extract_info_print_options): Define new function.
* cli/cli-utils.h (extract_info_print_args): Delete.
(struct info_print_options): New structure.
(extract_info_print_options): Declare new function.
* stack.c (info_locals_command): Update to use new
extract_info_print_options, also add a header comment.
(info_args_command): Likewise.
* symtab.c (info_variables_command): Likewise.
(info_functions_command): Likewise.

4 years agogdb: Allow quoting around string options in the gdb::option framework
Andrew Burgess [Thu, 11 Jul 2019 10:08:42 +0000 (11:08 +0100)] 
gdb: Allow quoting around string options in the gdb::option framework

Currently string options must be a single string with no whitespace,
this limitation prevents the gdb::option framework being used in some
places.

After this commit, string options can be quoted in single or double
quotes, and quote characters can be escaped with a backslash if needed
to either place them within quotes, or to avoid starting a quoted
argument.

This test adds a new function extract_string_maybe_quoted which is
basically a copy of extract_arg_maybe_quoted from cli/cli-utils.c,
however, the cli-utils.c function will be deleted in the next commit.

There are tests to exercise the new quoting mechanism.

gdb/ChangeLog:

* cli/cli-option.c (parse_option): Use extract_string_maybe_quoted
to extract string arguments.
* common/common-utils.c (extract_string_maybe_quoted): New function.
* common/common-utils.h (extract_string_maybe_quoted): Declare.

gdb/testsuite/ChangeLog:

* gdb.base/options.exp (expect_string): Dequote strings in
results.
(test-string): Test strings with different quoting and reindent.

4 years agoRemove init_cli_cmds
Tom Tromey [Thu, 11 Jul 2019 14:54:17 +0000 (08:54 -0600)] 
Remove init_cli_cmds

I noticed that init_cli_cmds only installs a command, and so doesn't
need to be handled specially.  This patch merges it into
_initialize_cli_cmds.

The help text is constructed dynamically, which is sometimes an
indication that special treatment is needed; but in this case it is
just to insert the value of "gdbinit", which is created at
compile-time and not modified; so this doesn't affect the result.

This version also removes the "gdbinit" global.  There's no need for
it, as GDBINIT can be used instead.  Note, though, that the help text
in question must still be dynamically constructed, in order to be
i18n-friendly.

gdb/ChangeLog
2019-07-11  Tom Tromey  <tromey@adacore.com>

* main.c (get_init_files): Use GDBINIT, not gdbinit.
* auto-load.c (file_is_auto_load_safe): Use GDBINIT, not gdbinit.
* top.h (gdbinit): Don't declare.
* cli/cli-cmds.c (init_cli_cmds): Remove, merging contents
into...
(_initialize_cli_cmds): ...here.  Use GDBINIT, not gdbinit.
* top.c (gdb_init): Don't call init_cli_cmds.
(gdbinit): Remove.
* cli/cli-cmds.h (init_cli_cmds): Don't declare.

4 years agoFix use-after-move bug in add_thread_object
Tom Tromey [Thu, 11 Jul 2019 15:09:52 +0000 (09:09 -0600)] 
Fix use-after-move bug in add_thread_object

commit 05b08ac1608 ("Reduce manual reference counting in
py-inferior.c") introduced a use-after-move bug in add_thread_object,
causing a test suite failure.  This patch fixes the bug.

Tested on x86-64 Fedora 29.

gdb/ChangeLog
2019-07-11  Tom Tromey  <tromey@adacore.com>

* python/py-inferior.c (add_thread_object): Don't use thread_obj
after it has been moved.

4 years agoMake value_must_coerce_to_target return a bool
Simon Marchi [Thu, 11 Jul 2019 01:49:32 +0000 (21:49 -0400)] 
Make value_must_coerce_to_target return a bool

... and move comment to header file.

gdb/ChangeLog:

* valops.c (value_must_coerce_to_target): Change return type to
bool.
* value.h (value_must_coerce_to_target): Likewise.

4 years agobreakpoint: Make is_*point functions return bool
Simon Marchi [Thu, 11 Jul 2019 01:20:38 +0000 (21:20 -0400)] 
breakpoint: Make is_*point functions return bool

This includes changing the FILTER parameters of two functions
accordingly.  I also tried to normalize the function comments to our
current standards.

gdb/ChangeLog:

* breakpoint.c (is_hardware_watchpoint): Remove
forward-declaration.
(is_masked_watchpoint): Change return type to bool.
(is_tracepoint): Likewise.
(is_breakpoint): Likewise.
(is_hardware_watchpoint): Likewise.
(is_watchpoint): Likewise.
(is_no_memory_software_watchpoint): Likewise.
(is_catchpoint): Likewise.
(breakpoint_1): Make FILTER parameter's return type bool.
is_masked_watchpoint): Change return type to bool.
(save_breakpoints): Make FILTER parameter's return type bool.
* breakpoint.h (is_breakpoint): Change return type to bool.
(is_watchpoint): Likewise.
(is_catchpoint): Likewise.
(is_tracepoint): Likewise.

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 11 Jul 2019 00:00:37 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoDon't include gdbarch.h from defs.h
Tom Tromey [Sun, 9 Jun 2019 21:21:02 +0000 (15:21 -0600)] 
Don't include gdbarch.h from defs.h

I touched symtab.h and was surprised to see how many files were
rebuilt.  I looked into it a bit, and found that defs.h includes
gdbarch.h, which in turn includes many things.

gdbarch.h is only needed by a minority ofthe files in gdb, so this
patch removes the include from defs.h and updates the fallout.

I did "wc -l" on the files in build/gdb/.deps; this patch reduces the
line count from 139935 to 137030; so there are definitely future
build-time savings here.

Note that while I configured with --enable-targets=all, it's possible
that some *-nat.c file needs an update.  I could not test all of
these.  The buildbot caught a few problems along these lines.

gdb/ChangeLog
2019-07-10  Tom Tromey  <tom@tromey.com>

* defs.h: Don't include gdbarch.h.
* aarch64-ravenscar-thread.c, aarch64-tdep.c, alpha-bsd-tdep.h,
alpha-linux-tdep.c, alpha-mdebug-tdep.c, arch-utils.h, arm-tdep.h,
ax-general.c, btrace.c, buildsym-legacy.c, buildsym.h, c-lang.c,
cli/cli-decode.h, cli/cli-dump.c, cli/cli-script.h,
cli/cli-style.h, coff-pe-read.h, compile/compile-c-support.c,
compile/compile-cplus.h, compile/compile-loc2c.c, corefile.c,
cp-valprint.c, cris-linux-tdep.c, ctf.c, d-lang.c, d-namespace.c,
dcache.c, dicos-tdep.c, dictionary.c, disasm-selftests.c,
dummy-frame.c, dummy-frame.h, dwarf2-frame-tailcall.c,
dwarf2expr.c, expression.h, f-lang.c, frame-base.c,
frame-unwind.c, frv-linux-tdep.c, gdbarch-selftests.c, gdbtypes.h,
go-lang.c, hppa-nbsd-tdep.c, hppa-obsd-tdep.c, i386-dicos-tdep.c,
i386-tdep.h, ia64-vms-tdep.c, interps.h, language.c,
linux-record.c, location.h, m2-lang.c, m32r-linux-tdep.c,
mem-break.c, memattr.c, mn10300-linux-tdep.c, nios2-linux-tdep.c,
objfiles.h, opencl-lang.c, or1k-linux-tdep.c, p-lang.c,
parser-defs.h, ppc-tdep.h, probe.h, python/py-record-btrace.c,
record-btrace.c, record.h, regcache-dump.c, regcache.h,
riscv-fbsd-tdep.c, riscv-linux-tdep.c, rust-exp.y,
sh-linux-tdep.c, sh-nbsd-tdep.c, source-cache.c,
sparc-nbsd-tdep.c, sparc-obsd-tdep.c, sparc-ravenscar-thread.c,
sparc64-fbsd-tdep.c, std-regs.c, target-descriptions.h,
target-float.c, tic6x-linux-tdep.c, tilegx-linux-tdep.c, top.c,
tracefile.c, trad-frame.c, type-stack.h, ui-style.c, utils.c,
utils.h, valarith.c, valprint.c, varobj.c, x86-tdep.c,
xml-support.h, xtensa-linux-tdep.c, cli/cli-cmds.h: Update.
* s390-linux-nat.c, procfs.c, inf-ptrace.c: Likewise.

4 years agoChange Ada catchpoints to be bp_catchpoint
Tom Tromey [Wed, 10 Jul 2019 17:05:20 +0000 (11:05 -0600)] 
Change Ada catchpoints to be bp_catchpoint

Like Pedro's earlier patches to change catchpoint to be of type
bp_catchpoint, this changes the Ada catchpoints to follow.

Tested on x86-64 Fedora 29.

gdb/ChangeLog
2019-07-10  Tom Tromey  <tromey@adacore.com>

* ada-lang.h (is_ada_exception_catchpoint): Declare.
* breakpoint.c (init_ada_exception_breakpoint): Register as
bp_catchpoint.
(print_one_breakpoint_location, print_one_breakpoint): Use
is_ada_exception_catchpoint.
* ada-lang.c (class ada_catchpoint_location): Pass
bp_loc_software_breakpoint to bp_location constructor.
(is_ada_exception_catchpoint): New function.

gdb/testsuite/ChangeLog
2019-07-10  Tom Tromey  <tromey@adacore.com>

* gdb.ada/mi_ex_cond.exp: Update expected results.
* gdb.ada/mi_catch_ex_hand.exp: Update expected results.
* gdb.ada/mi_catch_ex.exp: Update expected results.
* gdb.ada/mi_catch_assert.exp: Update expected results.
* gdb.ada/catch_ex.exp (catch_exception_info)
(catch_exception_entry, catch_assert_entry)
(catch_unhandled_entry): Update.
* gdb.ada/catch_assert_if.exp: Update expected results.

4 years agoChange arm-tdep.c to use type-safe registry
Tom Tromey [Tue, 2 Jul 2019 19:45:28 +0000 (13:45 -0600)] 
Change arm-tdep.c to use type-safe registry

This changes arm-tdep.c to use the type-safe registry, removing a use
of VEC in the process.

2019-07-10  Tom Tromey  <tromey@adacore.com>

* arm-tdep.c (arm_exidx_entry_s): Remove typedef.  Don't define
VEC.
(struct arm_exidx_entry): New method operator<.
(struct arm_exidx_data) <section_maps>: Change type.
(arm_exidx_data_free): Remove.
(arm_exidx_data_key): Change type.  Move lower.
(arm_exidx_new_objfile): Update.
(arm_compare_exidx_entries): Remove.
(arm_find_exidx_entry, _initialize_arm_tdep)

4 years agoChange solib-spu.c to use type-safe registry
Tom Tromey [Thu, 27 Jun 2019 19:52:42 +0000 (13:52 -0600)] 
Change solib-spu.c to use type-safe registry

This changes solib-spu.c to use the type-safe registry.

2019-07-10  Tom Tromey  <tromey@adacore.com>

* solib-spu.c (ocl_program_data_key): Change type.
(append_ocl_sos, ocl_enable_break, _initialize_spu_solib):
Update.

4 years agoChange solib-aix.c to use type-safe registry
Tom Tromey [Thu, 27 Jun 2019 19:48:44 +0000 (13:48 -0600)] 
Change solib-aix.c to use type-safe registry

This changes solib-aix.c to use the type-safe registry, and removes a
use of VEC in the process.

gdb/ChangeLog
2019-07-10  Tom Tromey  <tromey@adacore.com>

* solib-aix.c (lm_info_aix_p): Remove typedef.  Don't define VEC.
(struct solib_aix_inferior_data) <library_list>: Change type.
(solib_aix_inferior_data_handle): Change type.
(get_solib_aix_inferior_data): Update.
(solib_aix_free_library_list): Remove.
(library_list_start_library): Update.
(solib_aix_parse_libraries, solib_aix_get_library_list): Change
return type.
(solib_aix_get_library_list)
(solib_aix_solib_create_inferior_hook, solib_aix_current_sos)
(solib_aix_normal_stop_observer, _initialize_solib_aix): Update.

4 years agoChange solib-dsbt.c to use type-safe registry
Tom Tromey [Wed, 26 Jun 2019 19:16:18 +0000 (13:16 -0600)] 
Change solib-dsbt.c to use type-safe registry

This changes solib-dsbt.c to use the type-safe registry.

2019-07-10  Tom Tromey  <tromey@adacore.com>

* solib-dsbt.c (struct dsbt_info): Add initializers.
(solib_dsbt_pspace_data): Change type.
(dsbt_pspace_data_cleanup): Remove.
(get_dsbt_info, _initialize_dsbt_solib): Update.

4 years agoChange spu-tdep.c to use type-safe registry
Tom Tromey [Wed, 26 Jun 2019 19:14:29 +0000 (13:14 -0600)] 
Change spu-tdep.c to use type-safe registry

This changes spu-tdep.c to use the type-safe registry.

2019-07-10  Tom Tromey  <tromey@adacore.com>

* spu-tdep.c (spu_overlay_data): Change type.
(spu_get_overlay_table, spu_overlay_new_objfile)
(_initialize_spu_tdep): Update.

4 years agoChange dbxread.c to use type-safe registry
Tom Tromey [Wed, 26 Jun 2019 19:12:13 +0000 (13:12 -0600)] 
Change dbxread.c to use type-safe registry

This changes dbxread.c to use the type-safe registry.  In a couple of
spots, you'll see that dbx_objfile_data_key.emplace is called but the
result is not used; this is because those functions refer to the key
via the various DBX_* macros.

2019-07-10  Tom Tromey  <tromey@adacore.com>

* gdb-stabs.h (struct dbx_symfile_info): Add initializers and
destructor.
(dbx_objfile_data_key): Change type and declare later.
(DBX_SYMFILE_INFO): Rewrite.
* dbxread.c (dbx_objfile_data_key): Change type.
(dbx_symfile_init): Update.
(~dbx_symfile_info): Rename from dbx_free_symfile_info.  Update.
(coffstab_build_psymtabs, elfstab_build_psymtabs)
(stabsect_build_psymtabs, _initialize_dbxread): Update.

4 years agoChange jit.c to use type-safe registry
Tom Tromey [Wed, 26 Jun 2019 18:47:44 +0000 (12:47 -0600)] 
Change jit.c to use type-safe registry

This changes jit.c to use the type-safe registry.  Only one of the
registry keys in jit.c is converted; the other is trickier and so I've
left it be for now.

gdb/ChangeLog
2019-07-10  Tom Tromey  <tromey@adacore.com>

* jit.c (jit_program_space_key): Change type.  Move lower.
(get_jit_program_space_data): Update.
(jit_program_space_data_cleanup): Remove.
(jit_breakpoint_deleted, free_objfile_data, _initialize_jit):
Update.
(struct jit_program_space_data): Add initializers.

4 years agoChange solib-darwin.c to use type-safe registry
Tom Tromey [Wed, 26 Jun 2019 18:44:49 +0000 (12:44 -0600)] 
Change solib-darwin.c to use type-safe registry

This changes solib-darwin.c to use the type-safe registry.

2019-07-10  Tom Tromey  <tromey@adacore.com>

* solib-darwin.c (struct darwin_info): Add initializers.
(solib_darwin_pspace_data): Change type.
(darwin_pspace_data_cleanup): Remove.
(get_darwin_info, _initialize_darwin_solib): Update.

4 years agoChange remote-sim.c to use type-safe registry
Tom Tromey [Wed, 26 Jun 2019 18:42:14 +0000 (12:42 -0600)] 
Change remote-sim.c to use type-safe registry

This changes remote-sim.c to use the type-safe registry.

2019-07-10  Tom Tromey  <tromey@adacore.com>

* remote-sim.c (struct sim_inferior_data): Add initializers,
constructor, and destructor.
(sim_inferior_data_key): Change type.  Move lower.
(check_for_duplicate_sim_descriptor): Update.
(get_sim_inferior_data): Use new.  Update.
(~sim_inferior_data_cleanup): Rename from
sim_inferior_data_cleanup.  Simplify.
(gdbsim_close_inferior, simulator_command)
(sim_command_completer, _initialize_remote_sim): Update.
(next_pid, INITIAL_PID): Move earlier.

4 years agoReduce manual reference counting in py-inferior.c
Tom Tromey [Fri, 28 Jun 2019 14:32:28 +0000 (08:32 -0600)] 
Reduce manual reference counting in py-inferior.c

This patch changes py-inferior.c to use gdbpy_ref<> when possible,
reducing the amount of manual reference counting.

Tested on x86-64 Fedora 29.

gdb/ChangeLog
2019-07-10  Tom Tromey  <tromey@adacore.com>

* python/python-internal.h (create_thread_object): Return
gdbpy_ref.
* python/py-infthread.c (create_thread_object): Return gdbpy_ref.
* python/py-inferior.c (struct threadlist_entry): Add
constructor.
<thread_obj>: Now a gdbpy_ref.
(thread_to_thread_object): Update.
(add_thread_object): Use new.
(delete_thread_object): Use delete.
(infpy_threads): Update.
(py_free_inferior): Update.  Construct "inf_obj" after acquiring
GIL.

4 years agoSpecialize value_cast error message for Ada
Tom Tromey [Tue, 18 Jun 2019 14:59:00 +0000 (08:59 -0600)] 
Specialize value_cast error message for Ada

In Ada, the term for a cast is "type conversion".  AdaCore has been
carrying a local patch to specialize the error message in value_cast,
but it seemed fine to me for this to be part of gdb.  This also
removes a dead "return" statement.

gdb/ChangeLog
2019-07-10  Tom Tromey  <tromey@adacore.com>

* valops.c (value_cast): Specialize error message for Ada.

4 years agoarm-dis.c (print_insn_coprocessor): Rename index to index_operand.
Hans-Peter Nilsson [Wed, 10 Jul 2019 16:38:19 +0000 (18:38 +0200)] 
arm-dis.c (print_insn_coprocessor): Rename index to index_operand.

Older gcc warns, arguably incorrectly, about name collisions between
global functions and function-local variable names.  Consesus has been
to rename local variables whenever this is spotted, hence committed as
obvious.  Note the pre-existing variable named idx; "index_operand"
seemed logical given the context.

* arm-dis.c (print_insn_coprocessor): Rename index to
index_operand.

4 years agoUpdate breakpoint_1's documentation
Simon Marchi [Wed, 10 Jul 2019 16:12:37 +0000 (12:12 -0400)] 
Update breakpoint_1's documentation

I noticed the documentation of breakpoint_1 way way out of date, so this
is an attempt to update it.  I have changed the parameter names to
something that seems clearer to me.

gdb/ChangeLog:

* breakpoint.c (breakpoint_1): Update doc and parameter names.

4 years agoMake some bpstat functions use bool
Simon Marchi [Wed, 10 Jul 2019 16:10:51 +0000 (12:10 -0400)] 
Make some bpstat functions use bool

Change return type to bool and adjust function comments.

gdb/ChangeLog:

* breakpoint.h (bpstat_explains_signal, bpstat_causes_stop,
bpstat_should_step): Return bool, adjust comments.
* breakpoint.c (bpstat_explains_signal, bpstat_causes_stop,
bpstat_should_step): Likewise.

4 years agoArm: Create feature files for Arm target descriptions
Alan Hayward [Thu, 20 Jun 2019 07:38:18 +0000 (08:38 +0100)] 
Arm: Create feature files for Arm target descriptions

Add Arm to the list of feature target description targets and generate the
relevant C files.

Add arm-m-profile-with-fpa.xml as the feature version of the exisiting
arm-with-m-fpa-layout.xml.

Add extra comments to the Makefile for readability.

New files are not yet used.

gdb/ChangeLog:

* features/Makefile: Use feature target descriptions for Arm.
* features/arm/arm-core.c: Generate new file.
* features/arm/arm-fpa.c: Likewise.
* features/arm/arm-m-profile-with-fpa.xml: Likewise.
* features/arm/arm-m-profile.c: Likewise.
* features/arm/arm-vfpv2.c: Likewise.
* features/arm/arm-vfpv3.c: Likewise.
* features/arm/xscale-iwmmxt.c: Likewise.
* target-descriptions.c (maint_print_c_tdesc_cmd): Add Arm.

4 years agoRestore original GDB prompt in define.exp
Richard Bunt [Wed, 10 Jul 2019 13:14:16 +0000 (14:14 +0100)] 
Restore original GDB prompt in define.exp

define.exp will fail on a GDB which has set a custom prompt to identify
itself.  This is because the test resets the prompt to a hard coded
"(gdb)" but then verifies the success of this against the value in
$gdb_prompt, which is set to the custom prompt.

The original approach to fix this involved resetting the prompt to
$gdb_prompt rather than a hard coded "(gdb)". However it was noted during
review that $gdb_prompt is a regular expression rather than a string.
This is problematic because in general the prompt would be reset to a
regular expression rather than an instance of a string accepted by said
regular expression.

The fix used in this commit avoids the above issue by capturing the
literal prompt from running "show prompt" and uses this literal to
restore the previous prompt.

Regression tested with GCC 7.3.0 on x86_64, ppc64le, aarch64.

gdb/testsuite/ChangeLog:
2019-07-10  Richard Bunt  <richard.bunt@arm.com>
Stephen Roberts  <stephen.roberts@arm.com>

* gdb.base/define.exp: Restore original prompt.

4 years agoArm: Minor style cleanups
Alan Hayward [Tue, 25 Jun 2019 10:04:59 +0000 (11:04 +0100)] 
Arm: Minor style cleanups

*When reading a target description, do the ptrace check before picking the
 target description.

*In wmmxregset functions, declare the counter inside the for.

*Call arm_linux_init_hwbp_cap from in arm_arch_setup - it doesn't belong in
 arm_read_description.

gdb/ChangeLog:

* arm-linux-nat.c (arm_linux_nat_target::read_description): Check
ptrace earlier,

gdb/gdbserver/ChangeLog:

* linux-arm-low.c (arm_fill_wmmxregset, arm_store_wmmxregset):
Move counter inside for.
(arm_read_description): Check ptrace earlier.
(arm_arch_setup): Call arm_linux_init_hwbp_cap here.

4 years agoRegenerate aarch64-pauth.c
Alan Hayward [Wed, 10 Jul 2019 10:45:29 +0000 (11:45 +0100)] 
Regenerate aarch64-pauth.c

aarch64-pauth.c was slightly out of sync with the generated version.
Regenerate it.

gdb/ChangeLog:

* features/aarch64-pauth.c: Regenerate.

4 years agoMake bpstat_what::is_longjmp a bool
Simon Marchi [Wed, 10 Jul 2019 01:20:16 +0000 (21:20 -0400)] 
Make bpstat_what::is_longjmp a bool

gdb/ChangeLog:

* breakpoint.h (struct bpstat_what) <is_longjmp>: Change type to
bool.
(bpstat_what): Use false instead of 0.

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 10 Jul 2019 00:00:22 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoMake "maint info breakpoints" show "catch catch/throw/rethrow" locations
Pedro Alves [Tue, 9 Jul 2019 18:26:16 +0000 (19:26 +0100)] 
Make "maint info breakpoints" show "catch catch/throw/rethrow" locations

This commit makes "maint info breakpoints" show the internal locations
of C++ exception catchpoints:

 (gdb) info breakpoints
 Num     Type           Disp Enb Address            What
 2       catchpoint     keep y                      exception catch

With multiple locations:

 (gdb) maint info breakpoints
 Num     Type           Disp Enb Address            What
 2       catchpoint     keep y                      exception catch
 2.1                         y   0x000000000040545f <__cxa_begin_catch+95> inf 1
 2.2                         y   0x00007ffff71dbe0f <__cxxabiv1::__cxa_begin_catch(void*)+95> inf 1
 (gdb)

With a single location:

 (gdb) maint info breakpoints 2
 Num     Type           Disp Enb Address            What
 2       catchpoint     keep y                      exception catch inf 1
 2.1                         y   0x00007ffff7bc0b7f <__cxa_begin_catch+95> inf 1

With no locations:

 (gdb) maint info breakpoints 2
 Num     Type           Disp Enb Address            What
 2       catchpoint     keep y                      exception catch inf 1

Other catchpoints still show the same way, here a catch signal:

 (gdb) info breakpoints
 Num     Type           Disp Enb Address            What
 3       catchpoint     keep y                      signal "<standard signals>"

 (gdb) maint info breakpoints
 Num     Type           Disp Enb Address            What
 3       catchpoint     keep y                      signal "<standard signals>"  inf 1
 (gdb)

Note: I considered making the locations be printed from within
breakpoint_ops::print_one(), but gave up given the handling for the
broken MI v2 output:

 /* The mi2 broken format: the main breakpoint tuple ends here, the locations
     are outside.  */
  if (!use_fixed_output)
    bkpt_tuple_emitter.reset ();

in print_one_breakpoint.

gdb/ChangeLog:
2019-07-09  Pedro Alves  <palves@redhat.com>

* break-catch-throw.c (is_exception_catchpoint): New.
* breakpoint.c (print_one_breakpoint_location): New parameter
'raw_loc'.  Handle it.  Use
is_watchpoint/is_catchpoint/is_exception_catchpoint instead of
looking at the breakpoint's type.
(print_one_breakpoint): If handling "maint info breakpoints", also
print locations of exception catchpoints.
* breakpoint.h (is_exception_catchpoint): Declare.

4 years ago"catch catch/throw/rethrow", breakpoint -> catchpoint
Pedro Alves [Tue, 9 Jul 2019 18:26:16 +0000 (19:26 +0100)] 
"catch catch/throw/rethrow", breakpoint -> catchpoint

Currently, with:

 (gdb) catch catch
 Catchpoint 1 (catch)
 (gdb) catch throw
 Catchpoint 2 (throw)
 (gdb) catch rethrow
 Catchpoint 3 (rethrow)

You get:

(gdb) info breakpoints
 Num     Type           Disp Enb Address            What
 1       breakpoint     keep y   0x0000000000b122af exception catch
 2       breakpoint     keep y   0x0000000000b1288d exception throw
 3       breakpoint     keep y   0x0000000000b12931 exception rethrow

I think it doesn't make much sense usability-wise, to show a
catchpoint as a breakpoint.  The fact that GDB sets a breakpoint at
some magic address in the C++ run time is an implementation detail,
IMO.  And as seen in the previous patch, such a catchpoint can end up
with more than one location/address even, so showing a single address
isn't entirely accurate.

This commit hides the addresses from view, and makes GDB show
"catchpoint" for type as well:

  (gdb) info breakpoints
  Num     Type           Disp Enb Address            What
  1       catchpoint     keep y                      exception catch
  2       catchpoint     keep y                      exception throw
  3       catchpoint     keep y                      exception rethrow

This comment in the code seems telling:

  /* We need to reset 'type' in order for code in breakpoint.c to do
     the right thing.  */
  cp->type = bp_breakpoint;

It kind of suggests that the reason catchpoints end up shown as
breakpoints was that it was easier to implement them that way, rather
than a desired property.

This commit fixes things up to make it possible to have bp_catch
breakpoints have software/hardware breakpoint locations, thus
eliminating the need for that hack:

 - redo breakpoint_address_is_meaningful in terms of the location's
   type rather than breakpoint type.
 - teach bpstat_what about stepping over the catchpoint locations.
 - install a allocate_location method for "catch catch/throw/rethrow",
   one that forces the location type.

Note that this also reverts the gdb hunk from:

  commit 2a8be20359dba9cc684fd3ffa222d985399f3b18
  Commit:     Tom Tromey <tom@tromey.com>
  CommitDate: Sat Oct 6 22:17:45 2018 -0600

      Fix Python gdb.Breakpoint.location crash

because now "catch throw" catchpoints hit the

   if (obj->bp->type != bp_breakpoint)
     Py_RETURN_NONE;

check above, and, adjusts the testcase to no longer expect to see the
catchpoint in the gdb.breakpoints() list.

(Note: might make sense to do the same to Ada exception catchpoints.)

gdb/ChangeLog:
2019-07-09  Pedro Alves  <palves@redhat.com>

* break-catch-throw.c (print_one_exception_catchpoint): Skip the
"addr" field.
(allocate_location_exception_catchpoint): New.
(handle_gnu_v3_exceptions): Don't reset 'type' to bp_breakpoint.
(initialize_throw_catchpoint_ops): Install
allocate_location_exception_catchpoint as allocate_location
method.
* breakpoint.c (bpstat_what) <bp_catch>: Set action to
BPSTAT_WHAT_SINGLE if not stopping and the location's type is not
bp_loc_other.
(breakpoint_address_is_meaningful): Delete.
(bl_address_is_meaningful): New.
(breakpoint_locations_match): Adjust comment.
(bp_location_from_bp_type): New, factored out of...
(bp_location::bp_location(breakpoint *)): ... this.
(bp_location::bp_location(breakpoint *, bp_loc_type)): New,
factored out of...
(bp_location::bp_location(breakpoint *)): ... this.  Reimplement.
(bp_loc_is_permanent): Use bl_address_is_meaningful instead of
breakpoint_address_is_meaningful.
(bp_locations_compare): Adjust comment.
(update_global_location_list): Use bl_address_is_meaningful
instead of breakpoint_address_is_meaningful.
* breakpoint.h (bp_location::bp_location(breakpoint *)): New
explicit.
(bp_location::bp_location(breakpoint *, bp_loc_type)): Declare.
* python/py-breakpoint.c (bppy_get_location): No longer check
whether location is null.

gdb/doc/ChangeLog:
2019-07-09  Pedro Alves  <palves@redhat.com>

* gdb.texinfo (C++ Exception GDB/MI Catchpoint Commands): Adjust
examples to show type=catchpoint instead of type=breakpoint and an
address.

gdb/testsuite/ChangeLog:
2019-07-09  Pedro Alves  <palves@redhat.com>

* gdb.cp/catch-multi-stdlib.exp: Adjust expected "info
breakpoints" output.
* gdb.cp/exception.exp: Adjust expected "info breakpoints" output.
* gdb.python/py-breakpoint.exp: No longer expect that "catch
throw" creates breakpoint.
* gdb.mi/mi-catch-cpp-exceptions.exp (setup_catchpoint): Expect
'type="catchpoint"'.

4 years agoFix "info break" + "catch catch" + -static-{libstdc++,libgcc}
Pedro Alves [Tue, 9 Jul 2019 18:26:15 +0000 (19:26 +0100)] 
Fix "info break" + "catch catch" + -static-{libstdc++,libgcc}

If you debug current GDB, set a "catch catch/throw/rethrow"
catchpoint, and then do "info breakpoints", the top GDB hits an
internal error:

 (top-gdb) catch catch
 Catchpoint 1 (catch)
 (top-gdb) info breakpoints
 Num     Type           Disp Enb Address            What
 1       breakpoint     keep y   src/gdb/breakpoint.c:6040: internal-error: void print_one_breakpoint_location(breakpoint*, bp_location*, int, bp_location**, int): Assertion `b->loc == NULL || b->loc->next == NULL' failed.
 A problem internal to GDB has been detected,
 further debugging may prove unreliable.
 Quit this debugging session? (y or n)

The assertion in question is asserting that a breakpoint with a
print_one method only has one location, and it fails because this
catchpoint ends up with two locations.

Internally, "catch catch" sets a breakpoint at __cxa_begin_catch.  If
we do that manually, we see the locations:

  (top-gdb) b -qualified __cxa_begin_catch
  Breakpoint 2 at 0xb122b0 (2 locations)
  (top-gdb) info breakpoints
  Num     Type           Disp Enb Address            What
  2       breakpoint     keep y   <MULTIPLE>
  2.1                         y   0x0000000000b122b0 <__cxa_begin_catch>
  2.2                         y   0x00007ffff2f4ddb0 in __cxxabiv1::__cxa_begin_catch(void*) at ../../../../libstdc++-v3/libsupc++/eh_catch.cc:41

Note that I had used -qualified.  It seems strange that we get a
location for a namespaced symbol, but that happens because the minimal
symbol for that address is indeed called __cxa_begin_catch.

The real issue is that gdb is linked with
-static-libgcc/-static-libstdc++.  And then, it _also_ ends up with
shared libstc++ loaded:

  (top-gdb) info sharedlibrary stdc++
  From                To                  Syms Read   Shared Object Library
  0x00007ffff2f4b380  0x00007ffff2ffc018  Yes         /lib64/libstdc++.so.6

Location 2.2 is set within libstdc++.so.6's range:

  (top-gdb) p 0x00007ffff2f4b380 <= 0x00007ffff2f4ddb0 && 0x00007ffff2f4ddb0 < 0x00007ffff2ffc018
  $1 = true

So due to -static-lib*, we end up with _two_ copies of the
__cxa_begin_catch code:

  (top-gdb) disassemble 0x0000000000b122b0
  Dump of assembler code for function __cxa_begin_catch:
     0x0000000000b122b0 <+0>:     push   %rbx
     0x0000000000b122b1 <+1>:     mov    %rdi,%rbx
     0x0000000000b122b4 <+4>:     callq  0xb11a80 <__cxa_get_globals>
     0x0000000000b122b9 <+9>:     movabs $0xb8b1aabcbcd4d500,%rdx
  ...

  (top-gdb) disassemble 0x00007ffff2f4ddb0
  Dump of assembler code for function __cxxabiv1::__cxa_begin_catch(void*):
     0x00007ffff2f4ddb0 <+0>:     push   %rbx
     0x00007ffff2f4ddb1 <+1>:     mov    %rdi,%rbx
     0x00007ffff2f4ddb4 <+4>:     callq  0x7ffff2f4a090 <__cxa_get_globals@plt>
     0x00007ffff2f4ddb9 <+9>:     movabs $0xb8b1aabcbcd4d500,%rdx
  ...

I think we end up with libstdc++.so.6 loaded because
libsource-highlight.so depends on it.

Irrespective of whether it's a good idea to use
-static-libgcc/-static-libstdc++, GDB should not crash.  Since there
are two copies of the code, it seems right to have more than one
location.  So the fix is just to remove the assertion.

A testcase is included, which mimics the scenerio described above,
with binary linked with -static-lib{stdc++,gcc} and a shared library
that is linked normally, along with other combinations for good
measure.

gdb/ChangeLog:
2019-07-09  Pedro Alves  <palves@redhat.com>

PR c++/15468
* breakpoint.c (print_one_breakpoint_location): Remove
single-location assert.

gdb/testsuite/ChangeLog:
2019-07-09  Pedro Alves  <palves@redhat.com>

PR c++/15468
* gdb.cp/except-multi-location-lib.cc: New.
* gdb.cp/except-multi-location-main.cc: New.
* gdb.cp/except-multi-location.exp: New.

4 years agoFix printcmds.exp failure for wide strings tests.
Philippe Waroquiers [Tue, 9 Jul 2019 17:36:17 +0000 (19:36 +0200)] 
Fix printcmds.exp failure for wide strings tests.

wchar_t type must be known to create wide strings.
As this type is predefined when current GDB language is C++,
switch to c++ for the wide strings tests.

Problem analysis and fix by Sergio.

4 years agoRename common to gdbsupport
Tom Tromey [Mon, 6 May 2019 02:29:24 +0000 (20:29 -0600)] 
Rename common to gdbsupport

This is the next patch in the ongoing series to move gdbsever to the
top level.

This patch just renames the "common" directory.  The idea is to do
this move in two parts: first rename the directory (this patch), then
move the directory to the top.  This approach makes the patches a bit
more tractable.

I chose the name "gdbsupport" for the directory.  However, as this
patch was largely written by sed, we could pick a new name without too
much difficulty.

Tested by the buildbot.

gdb/ChangeLog
2019-07-09  Tom Tromey  <tom@tromey.com>

* contrib/ari/gdb_ari.sh: Change common to gdbsupport.
* configure: Rebuild.
* configure.ac: Change common to gdbsupport.
* gdbsupport: Rename from common.
* acinclude.m4: Change common to gdbsupport.
* Makefile.in (CONFIG_SRC_SUBDIR, COMMON_SFILES)
(HFILES_NO_SRCDIR, stamp-version, ALLDEPFILES): Change common to
gdbsupport.
* aarch64-tdep.c, ada-lang.c, ada-lang.h, agent.c, alloc.c,
amd64-darwin-tdep.c, amd64-dicos-tdep.c, amd64-fbsd-nat.c,
amd64-fbsd-tdep.c, amd64-linux-nat.c, amd64-linux-tdep.c,
amd64-nbsd-tdep.c, amd64-obsd-tdep.c, amd64-sol2-tdep.c,
amd64-tdep.c, amd64-windows-tdep.c, arch-utils.c,
arch/aarch64-insn.c, arch/aarch64.c, arch/aarch64.h, arch/amd64.c,
arch/amd64.h, arch/arm-get-next-pcs.c, arch/arm-linux.c,
arch/arm.c, arch/i386.c, arch/i386.h, arch/ppc-linux-common.c,
arch/riscv.c, arch/riscv.h, arch/tic6x.c, arm-tdep.c, auto-load.c,
auxv.c, ax-gdb.c, ax-general.c, ax.h, breakpoint.c, breakpoint.h,
btrace.c, btrace.h, build-id.c, build-id.h, c-lang.h, charset.c,
charset.h, cli/cli-cmds.c, cli/cli-cmds.h, cli/cli-decode.c,
cli/cli-dump.c, cli/cli-option.h, cli/cli-script.c,
coff-pe-read.c, command.h, compile/compile-c-support.c,
compile/compile-c.h, compile/compile-cplus-symbols.c,
compile/compile-cplus-types.c, compile/compile-cplus.h,
compile/compile-loc2c.c, compile/compile.c, completer.c,
completer.h, contrib/ari/gdb_ari.sh, corefile.c, corelow.c,
cp-support.c, cp-support.h, cp-valprint.c, csky-tdep.c, ctf.c,
darwin-nat.c, debug.c, defs.h, disasm-selftests.c, disasm.c,
disasm.h, dtrace-probe.c, dwarf-index-cache.c,
dwarf-index-cache.h, dwarf-index-write.c, dwarf2-frame.c,
dwarf2expr.c, dwarf2loc.c, dwarf2read.c, event-loop.c,
event-top.c, exceptions.c, exec.c, extension.h, fbsd-nat.c,
features/aarch64-core.c, features/aarch64-fpu.c,
features/aarch64-pauth.c, features/aarch64-sve.c,
features/i386/32bit-avx.c, features/i386/32bit-avx512.c,
features/i386/32bit-core.c, features/i386/32bit-linux.c,
features/i386/32bit-mpx.c, features/i386/32bit-pkeys.c,
features/i386/32bit-segments.c, features/i386/32bit-sse.c,
features/i386/64bit-avx.c, features/i386/64bit-avx512.c,
features/i386/64bit-core.c, features/i386/64bit-linux.c,
features/i386/64bit-mpx.c, features/i386/64bit-pkeys.c,
features/i386/64bit-segments.c, features/i386/64bit-sse.c,
features/i386/x32-core.c, features/riscv/32bit-cpu.c,
features/riscv/32bit-csr.c, features/riscv/32bit-fpu.c,
features/riscv/64bit-cpu.c, features/riscv/64bit-csr.c,
features/riscv/64bit-fpu.c, features/tic6x-c6xp.c,
features/tic6x-core.c, features/tic6x-gp.c, filename-seen-cache.h,
findcmd.c, findvar.c, fork-child.c, gcore.c, gdb_bfd.c, gdb_bfd.h,
gdb_proc_service.h, gdb_regex.c, gdb_select.h, gdb_usleep.c,
gdbarch-selftests.c, gdbthread.h, gdbtypes.h, gnu-nat.c,
go32-nat.c, guile/guile.c, guile/scm-ports.c,
guile/scm-safe-call.c, guile/scm-type.c, i386-fbsd-nat.c,
i386-fbsd-tdep.c, i386-go32-tdep.c, i386-linux-nat.c,
i386-linux-tdep.c, i386-tdep.c, i387-tdep.c,
ia64-libunwind-tdep.c, ia64-linux-nat.c, inf-child.c,
inf-ptrace.c, infcall.c, infcall.h, infcmd.c, inferior-iter.h,
inferior.c, inferior.h, inflow.c, inflow.h, infrun.c, infrun.h,
inline-frame.c, language.h, linespec.c, linux-fork.c, linux-nat.c,
linux-tdep.c, linux-thread-db.c, location.c, machoread.c,
macrotab.h, main.c, maint.c, maint.h, memattr.c, memrange.h,
mi/mi-cmd-break.h, mi/mi-cmd-env.c, mi/mi-cmd-stack.c,
mi/mi-cmd-var.c, mi/mi-interp.c, mi/mi-main.c, mi/mi-parse.h,
minsyms.c, mips-linux-tdep.c, namespace.h,
nat/aarch64-linux-hw-point.c, nat/aarch64-linux-hw-point.h,
nat/aarch64-linux.c, nat/aarch64-sve-linux-ptrace.c,
nat/amd64-linux-siginfo.c, nat/fork-inferior.c,
nat/linux-btrace.c, nat/linux-btrace.h, nat/linux-namespaces.c,
nat/linux-nat.h, nat/linux-osdata.c, nat/linux-personality.c,
nat/linux-procfs.c, nat/linux-ptrace.c, nat/linux-ptrace.h,
nat/linux-waitpid.c, nat/mips-linux-watch.c,
nat/mips-linux-watch.h, nat/ppc-linux.c, nat/x86-dregs.c,
nat/x86-dregs.h, nat/x86-linux-dregs.c, nat/x86-linux.c,
nto-procfs.c, nto-tdep.c, objfile-flags.h, objfiles.c, objfiles.h,
obsd-nat.c, observable.h, osdata.c, p-valprint.c, parse.c,
parser-defs.h, ppc-linux-nat.c, printcmd.c, probe.c, proc-api.c,
procfs.c, producer.c, progspace.h, psymtab.h,
python/py-framefilter.c, python/py-inferior.c, python/py-ref.h,
python/py-type.c, python/python.c, record-btrace.c, record-full.c,
record.c, record.h, regcache-dump.c, regcache.c, regcache.h,
remote-fileio.c, remote-fileio.h, remote-sim.c, remote.c,
riscv-tdep.c, rs6000-aix-tdep.c, rust-exp.y, s12z-tdep.c,
selftest-arch.c, ser-base.c, ser-event.c, ser-pipe.c, ser-tcp.c,
ser-unix.c, skip.c, solib-aix.c, solib-target.c, solib.c,
source-cache.c, source.c, source.h, sparc-nat.c, spu-linux-nat.c,
stack.c, stap-probe.c, symfile-add-flags.h, symfile.c, symfile.h,
symtab.c, symtab.h, target-descriptions.c, target-descriptions.h,
target-memory.c, target.c, target.h, target/waitstatus.c,
target/waitstatus.h, thread-iter.h, thread.c, tilegx-tdep.c,
top.c, top.h, tracefile-tfile.c, tracefile.c, tracepoint.c,
tracepoint.h, tui/tui-io.c, ui-file.c, ui-out.h,
unittests/array-view-selftests.c,
unittests/child-path-selftests.c, unittests/cli-utils-selftests.c,
unittests/common-utils-selftests.c,
unittests/copy_bitwise-selftests.c, unittests/environ-selftests.c,
unittests/format_pieces-selftests.c,
unittests/function-view-selftests.c,
unittests/lookup_name_info-selftests.c,
unittests/memory-map-selftests.c, unittests/memrange-selftests.c,
unittests/mkdir-recursive-selftests.c,
unittests/observable-selftests.c,
unittests/offset-type-selftests.c, unittests/optional-selftests.c,
unittests/parse-connection-spec-selftests.c,
unittests/ptid-selftests.c, unittests/rsp-low-selftests.c,
unittests/scoped_fd-selftests.c,
unittests/scoped_mmap-selftests.c,
unittests/scoped_restore-selftests.c,
unittests/string_view-selftests.c, unittests/style-selftests.c,
unittests/tracepoint-selftests.c, unittests/unpack-selftests.c,
unittests/utils-selftests.c, unittests/xml-utils-selftests.c,
utils.c, utils.h, valarith.c, valops.c, valprint.c, value.c,
value.h, varobj.c, varobj.h, windows-nat.c, x86-linux-nat.c,
xml-support.c, xml-support.h, xml-tdesc.h, xstormy16-tdep.c,
xtensa-linux-nat.c, dwarf2read.h: Change common to gdbsupport.

gdb/gdbserver/ChangeLog
2019-07-09  Tom Tromey  <tom@tromey.com>

* configure: Rebuild.
* configure.ac: Change common to gdbsupport.
* acinclude.m4: Change common to gdbsupport.
* Makefile.in (SFILES, OBS, GDBREPLAY_OBS, IPA_OBJS)
(version-generated.c, gdbsupport/%-ipa.o, gdbsupport/%.o): Change
common to gdbsupport.
* ax.c, event-loop.c, fork-child.c, gdb_proc_service.h,
gdbreplay.c, gdbthread.h, hostio-errno.c, hostio.c, i387-fp.c,
inferiors.c, inferiors.h, linux-aarch64-tdesc-selftest.c,
linux-amd64-ipa.c, linux-i386-ipa.c, linux-low.c,
linux-tic6x-low.c, linux-x86-low.c, linux-x86-tdesc-selftest.c,
linux-x86-tdesc.c, lynx-i386-low.c, lynx-low.c, mem-break.h,
nto-x86-low.c, regcache.c, regcache.h, remote-utils.c, server.c,
server.h, spu-low.c, symbol.c, target.h, tdesc.c, tdesc.h,
thread-db.c, tracepoint.c, win32-i386-low.c, win32-low.c: Change
common to gdbsupport.

4 years agogdb: Don't skip prologue for explicit line breakpoints in assembler
Andrew Burgess [Tue, 11 Jun 2019 22:33:53 +0000 (23:33 +0100)] 
gdb: Don't skip prologue for explicit line breakpoints in assembler

It was observed that in some cases, placing a breakpoint in an
assembler file using filename:line-number syntax would result in the
breakpoint being placed at a different line within the file.

For example, consider this x86-64 assembler:

    test:
            push   %rbp /* Break here.  */
            mov    %rsp, %rbp
            nop /* Stops here.  */

The user places the breakpoint using file:line notation targeting the
line marked 'Break here', GDB actually stops at the line marked 'Stops
here'.

The reason is that the label 'test' is identified as the likely start
of a function, and the call to symtab.c:skip_prologue_sal causes GDB
to skip forward over the instructions that GDB believes to be part of
the prologue.

I believe however, that when debugging assembler code, where the user
has instruction-by-instruction visibility, if they ask for a specific
line, GDB should (as far as possible) stop on that line, and not
perform any prologue skipping.  I don't believe that the behaviour of
higher level languages should change, in these cases skipping the
prologue seems like the correct thing to do.

In order to implement this change I needed to extend our current
tracking of when the user has requested an explicit line number.  We
already tracked this in some cases, but not in others (see the changes
in linespec.c).  However, once I did this I started to see some
additional failures (in tests gdb.base/break-include.exp
gdb.base/ending-run.exp gdb.mi/mi-break.exp gdb.mi/mi-reverse.exp
gdb.mi/mi-simplerun.exp) where we currently expected a breakpoint
placed at one file and line number to be updated to reference a
different line number, this was fixed by removing some code in
symtab.c:skip_prologue_sal.  My concern here is that removing this
check didn't cause anything else to fail.

I have a new test that covers my original case, this is written for
x86-64 as most folk have access to such a target, however, any
architecture that has a prologue scanner can be impacted by this
change.

gdb/ChangeLog:

* linespec.c (decode_digits_list_mode): Set explicit_line to a
bool value.
(decode_digits_ordinary): Set explicit_line field in sal.
* symtab.c (skip_prologue_sal): Don't skip prologue for a
symtab_and_line that was set on an explicit line number in
assembler code.  Do always update the recorded symtab and line if
we do skip the prologue.

gdb/testsuite/ChangeLog:

* gdb.arch/amd64-break-on-asm-line.S: New file.
* gdb.arch/amd64-break-on-asm-line.exp: New file.

4 years agogdb: Remove unneeded parameter from set_breakpoint_location_function
Andrew Burgess [Mon, 1 Jul 2019 15:00:52 +0000 (16:00 +0100)] 
gdb: Remove unneeded parameter from set_breakpoint_location_function

The explicit_loc parameter in set_breakpoint_location_function is not
useful.  This parameter is set from two possible fields of the
symtab_and_line used to create the breakpoint; the explicit_pc field,
and the explicit_line field.

First, the explicit_line field, this is not currently set for any
breakpoint command, so will never be true.

Next, the explicit_pc field.  This can be true but will never be true
at the same time that the sal->msymbol field is also true - the
sal->msymbol is only ever set in linespec.c:minsym_found, which
doesn't allow for explicitly setting the pc.

The result of this is that if we are setting a breakpoint on an
msymbol that could turn out to be an ifunc, then we will not also have
either an explicit_pc or an explicit_line, this check can therefore be
removed.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* breakpoint.c (set_breakpoint_location_function): Remove
explicit_loc parameter.
(momentary_breakpoint_from_master): Update call to
set_breakpoint_location_function.
(add_location_to_breakpoint): Likewise.

4 years agogdb/riscv: Don't use default bfd to define required features
Andrew Burgess [Thu, 4 Jul 2019 20:02:43 +0000 (21:02 +0100)] 
gdb/riscv: Don't use default bfd to define required features

When we initialise a gdbarch object we perform a check to try and
detect if the user is doing something silly; trying to run an RV64
binary on an RV32 target.  To perform this check we compare the xlen
from the target description with the xlen specified in the headers on
the ELF being debugged.

If there is no ELF being debugged then we (currently) try to use the
bfd_arch_info from the gdbarch_info object, which will have been set
to the default architecture if no bfd is currently being debugged.
For RISC-V the default architecture is RV64.

What this means is that if a user tries to connect to an RV32 target
without specifying the BFD to debug then GDB will assume RV64.  The
sanity check mentioned above will failed (xlen difference) and GDB
will throw an error.  The error causes GDB to disconnect from the
remote target.

After this commit GDB no longer relies on the default bfd
architecture.  If the user tries to connect without specifying the bfd
then GDB will simply make use of the xlen extracted from the target
description in order to find or create a suitable gdbarch object.

gdb/ChangeLog:

* riscv-tdep.c (riscv_features_from_gdbarch_info): Don't modify
required features based on default bfd type when no specific bfd
is present.

4 years agoRe: gas/ELF: don't accumulate .type settings
Alan Modra [Tue, 9 Jul 2019 02:57:55 +0000 (12:27 +0930)] 
Re: gas/ELF: don't accumulate .type settings

git commit f2d4ba38f5 caused many failures for mips-sgi-irix targets,
and added a new test that failed for aarch64, nds32, and rl78.
The mips failures are due to BSF_OBJECT being set in many cases for
symbols by the mips .global/.globl directive.  This patch removes that
code and instead sets BSF_OBJECT in a target frob_symbol function,
also moving the mips hacks in elf_frob_symbol to the new function.

Note that common symbols are handled fine in elf.c:swap_out_syms
without needing to set BSF_OBJECT, so that old code can disappear.

* config/obj-elf.c (elf_frob_symbol): Remove mips hacks.
* config/tc-mips.h (tc_frob_symbol): Define.
(mips_frob_symbol): Declare.
* config/tc-mips.c (s_mips_globl): Don't set BSF_OBJECT for irix.
(mips_frob_symbol): Fudge symbols for irix here.
* testsuite/gas/elf/type-2.e: Allow random target symbols.

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 9 Jul 2019 00:00:12 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoEnsure GDB printf command can print convenience var strings without a target.
Philippe Waroquiers [Mon, 10 Jun 2019 19:41:51 +0000 (21:41 +0200)] 
Ensure GDB printf command can print convenience var strings without a target.

Without this patch, GDB printf command calls malloc on the target,
writes the convenience var content to the target,
re-reads the content from the target, and then locally printf the string.

This implies inferior calls, and does not work when there is no running
inferior, or when the inferior is a core dump.

With this patch, printf command can printf string convenience variables
without inferior function calls.
Ada string convenience variables can also be printed.

gdb/ChangeLog
2019-07-08  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* NEWS: Mention that GDB printf and eval commands can now print
C-style and Ada-style convenience var strings without
calling the inferior.
* printcmd.c (printf_c_string): Locally print GDB internal var
instead of transiting via the inferior.
(printf_wide_c_string): Likewise.

gdb/testsuite/ChangeLog
2019-07-08  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.base/printcmds.exp: Test printing C string and
C wide string convenience vars without transiting via the inferior.
Also make test names unique.

4 years agoFix breakpoints on file reloads for PIE binaries
Alan Hayward [Mon, 8 Jul 2019 09:00:25 +0000 (10:00 +0100)] 
Fix breakpoints on file reloads for PIE binaries

When a binary is built using PIE, reloading the file will cause GDB to error
on restart.  For example:
gdb ./a.out
(gdb) break main
(gdb) run
(gdb) file ./a.out
(gdb) continue

Will cause GDB to error with:
Continuing.
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x9e0
Command aborted.

This is due to the symbol offsets not being relocated after reloading the file.

Fix is to ensure solib_create_inferior_hook is called, in the same manner as
infrun.c:follow_exec().

Expand the idempotent test to cover PIE scenarios.

gdb/ChangeLog:

* symfile.c (symbol_file_command): Call solib_create_inferior_hook.

gdb/testsuite/ChangeLog:

* gdb.base/break-idempotent.exp: Test both PIE and non PIE.

4 years agoPR24785, bfd crashes on empty .PPC.EMB.apuinfo section
Alan Modra [Mon, 8 Jul 2019 00:36:09 +0000 (10:06 +0930)] 
PR24785, bfd crashes on empty .PPC.EMB.apuinfo section

PR 24785
* elf32-ppc.c (_bfd_elf_ppc_set_arch): Sanity check .PPC.EMB.apuinfo
size before reading first word.

4 years agoRe: PowerPC notoc call stub tests
Alan Modra [Mon, 8 Jul 2019 00:35:39 +0000 (10:05 +0930)] 
Re: PowerPC notoc call stub tests

Correct the tests for powerpc 32-bit targets.

* testsuite/ld-powerpc/callstub-1.d: Pass -melf64ppc to ld.
* testsuite/ld-powerpc/callstub-2.d: Likewise.

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 8 Jul 2019 00:00:36 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 7 Jul 2019 00:01:05 +0000 (00:01 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 6 Jul 2019 00:00:25 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoKito's 5-part patch set to improve .insn support.
Jim Wilson [Fri, 5 Jul 2019 07:19:11 +0000 (15:19 +0800)] 
Kito's 5-part patch set to improve .insn support.

From Kito Cheng <kito.cheng@sifive.com>
gas/ChangeLog
* doc/c-riscv.texi (Instruction Formats): Add r4 type.
* testsuite/gas/riscv/insn.d: Add testcase for r4 type.
* testsuite/gas/riscv/insn.s: Ditto.
* doc/c-riscv.texi (Instruction Formats): Add b and j type.
* testsuite/gas/riscv/insn.d: Add test case for b and j type.
* testsuite/gas/riscv/insn.s: Ditto.
* testsuite/gas/riscv/insn.s: Correct instruction type for load
and store.
* testsuite/gas/riscv/insn.d: Using regular expression to match
address.
* doc/c-riscv.texi (Instruction Formats): Fix encoding table for SB
type and fix typo.
opcode/ChangeLog
* riscv-opc.c (riscv_insn_types): Add r4 type.
* riscv-opc.c (riscv_insn_types): Add b and j type.
* opcodes/riscv-opc.c (riscv_insn_types): Remove incorrect
format for sb type and correct s type.

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 5 Jul 2019 00:00:16 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoFix TUI use of "has_break" field
Tom Tromey [Tue, 25 Jun 2019 20:42:49 +0000 (14:42 -0600)] 
Fix TUI use of "has_break" field

The TUI uses the "has_break" in two different ways: sometimes as a
boolean, and sometimes as flags.

This patch changes the TUI to be more type-safe here, and fixes the
code.  I could not find a bug that this caused, so apparently this is
just cosmetic.

This deletes some code from tui_set_disassem_content.  Whenver this is
called, I believe the TUI updates the breakpoint information
afterward, so this assignment is redundant; which is good because it
is also incorrect.

gdb/ChangeLog
2019-07-04  Tom Tromey  <tom@tromey.com>

PR tui/24724:
* tui/tui-winsource.c (tui_clear_source_content): Update.
(tui_source_window_base::set_is_exec_point_at): Fix comment.
(tui_update_breakpoint_info): Update.
(tui_set_exec_info_content): Update.
* tui/tui-source.c (tui_set_source_content_nil): Update.
* tui/tui-disasm.c (tui_set_disassem_content): Don't set
has_break.
* tui/tui-data.h (enum tui_bp_flag): New.
(tui_bp_flags): New enum flags type.
(struct tui_source_element) <break_mode>: Change type.  Rename
from has_break.
(TUI_BP_ENABLED, TUI_BP_DISABLED, TUI_BP_HIT)
(TUI_BP_CONDITIONAL, TUI_BP_HARDWARE): Don't define.  Now enum
constants.
* tui/tui-winsource.h: Fix comment.

4 years agoFix foreach_with_prefix regression
Pedro Alves [Thu, 4 Jul 2019 15:45:23 +0000 (16:45 +0100)] 
Fix foreach_with_prefix regression

Fix a silly bug in commit a26c8de0ee93 ("Fix early return in
foreach_with_prefix").

That patch made foreach_with_prefix always return after the first
iteration, making ~10k tests disappear from test runs...

This fixes it, and as penance, adds a testcase that exercises all
kinds of different returns possible (ok, error, return, break,
continue).  I've written it with regular "foreach", and then switched
to foreach_with_prefix and made sure we get the same results.  I put
the testcase in a new gdb.testsuite/ subdir, since this is exercising
the testsuite harness bits.  We can move this elsewhere if people
prefer a different place, but I'm going ahead in order to unbreak the
testsuite ASAP.

gdb/testsuite/ChangeLog:
2019-07-04  Pedro Alves  <palves@redhat.com>

* lib/gdb.exp (foreach_with_prefix): Don't return early if
body returned ok(0), break(3) or continue(4).
* gdb.testsuite/foreach_with_prefix.exp: New file.

4 years agoArm/AArch64: Use a single set of Arm register set size defines
Alan Hayward [Tue, 25 Jun 2019 10:02:32 +0000 (11:02 +0100)] 
Arm/AArch64: Use a single set of Arm register set size defines

Both targets were using a mixture of defines and hardcoded values.
Add a standard set in arch/arm.h and use throughout, ensuring that
none of the existing sizes change.

No functionality changes.

gdb/ChangeLog:

* aarch32-linux-nat.h (VFP_REGS_SIZE): Remove define.
* aarch64-linux-nat.c (fetch_fpregs_from_thread)
(store_fpregs_to_thread)
(aarch64_linux_nat_target::read_description): Use ARM_VFP3_REGS_SIZE.
* arch/arm.h (IWMMXT_VEC_REGISTER_SIZE, ARM_CORE_REGS_SIZE)
(ARM_FP_REGS_SIZE, ARM_VFP2_REGS_SIZE, ARM_VFP3_REGS_SIZE)
(IWMMXT_REGS_SIZE): Add define.
* arm-linux-nat.c (IWMMXT_REGS_SIZE): Remove define.
(fetch_vfp_regs, store_vfp_regs)
(arm_linux_nat_target::read_description): Use ARM_VFP3_REGS_SIZE.
* arm-tdep.c (arm_register_g_packet_guesses): Use new defines.

gdb/gdbserver/ChangeLog:

* linux-aarch32-low.c (arm_read_description, arm_regsets): Use new
defines.
* linux-arm-low.c (arm_read_description, arm_regsets): Likewise.

4 years agoArm: Prefix register sizes with ARM_
Alan Hayward [Wed, 26 Jun 2019 09:12:13 +0000 (10:12 +0100)] 
Arm: Prefix register sizes with ARM_

Add ARM_ to the front of INT_REGISTER_SIZE, FP_REGISTER_SIZE and
ARM_VFP_REGISTER_SIZE to make it obvious they are for the Arm target.
Move the defines to arch/arm.h

No functionality changes.

gdb/ChangeLog:

* arch/arm-get-next-pcs.c (thumb_get_next_pcs_raw): Use ARM_
defines.
* arch/arm-linux.c (arm_linux_sigreturn_next_pc_offset): Likewise.
* arch/arm.h (INT_REGISTER_SIZE) Rename from...
(ARM_INT_REGISTER_SIZE): ...to this.
(ARM_FP_REGISTER_SIZE) (ARM_VFP_REGISTER_SIZE): Add define.
* arm-linux-tdep.c (ARM_LINUX_JB_ELEMENT_SIZE)
(ARM_LINUX_SIZEOF_GREGSET, arm_linux_supply_gregset)
(arm_linux_collect_gregset, supply_nwfpe_register)
(collect_nwfpe_register, arm_linux_collect_nwfpe): Use ARM_
defines.
* arm-linux-tdep.h (ARM_LINUX_SIZEOF_NWFPE, NWFPE_FPSR_OFFSET)
(NWFPE_FPCR_OFFSET, NWFPE_TAGS_OFFSET): Likewise
* arm-nbsd-tdep.c (ARM_NBSD_JB_ELEMENT_SIZE): Likewise.
* arm-tdep.c (arm_push_dummy_call, arm_extract_return_value)
(arm_return_in_memory, arm_store_return_value)
(arm_get_longjmp_target, arm_register_g_packet_guesses)
(arm_record_ld_st_multiple): Likewise.
* arm-tdep.h (FP_REGISTER_SIZE, VFP_REGISTER_SIZE): Remove.
* arm-wince-tdep.c (ARM_WINCE_JB_ELEMENT_SIZE): Use ARM_ defines.

4 years agoArm/AArch64: Split DISPLACED_MODIFIED_INSNS name clash
Alan Hayward [Thu, 4 Jul 2019 11:41:20 +0000 (12:41 +0100)] 
Arm/AArch64: Split DISPLACED_MODIFIED_INSNS name clash

Both targets define DISPLACED_MODIFIED_INSNS, each with different values.
Add ARM_ and AARCH64_ to the start of the name to prevent confusion.

No functionality changes.

gdb/ChangeLog:

* aarch64-linux-tdep.c (aarch64_linux_init_abi): Use
AARCH64_DISPLACED_MODIFIED_INSNS.
* aarch64-tdep.c (struct aarch64_displaced_step_data)
(aarch64_displaced_step_copy_insn): Likewise.
* aarch64-tdep.h (DISPLACED_MODIFIED_INSNS): Rename from..
(AARCH64_DISPLACED_MODIFIED_INSNS): ...to this.
* arm-linux-tdep.c (arm_linux_cleanup_svc): Use
ARM_DISPLACED_MODIFIED_INSNS.
* arm-tdep.c (arm_gdbarch_init): Likewise.
* arm-tdep.h (DISPLACED_MODIFIED_INSNS): Rename from..
(ARM_DISPLACED_MODIFIED_INSNS): ...to this.
(struct arm_displaced_step_closure): Use
ARM_DISPLACED_MODIFIED_INSNS.

4 years agoi386/AArch64: Remove unused xml files
Alan Hayward [Thu, 4 Jul 2019 10:53:25 +0000 (11:53 +0100)] 
i386/AArch64: Remove unused xml files

Remove all the xml files that are no longer used by gdbserver,
and remove their entries from the makefile.

gdb/ChangeLog:

* features/Makefile: Remove unused xml files.
* features/aarch64.xml: Remove.
* features/i386/amd64-avx-avx512-linux.xml: Remove.
* features/i386/amd64-avx-avx512.xml: Remove.
* features/i386/amd64-avx-linux.xml: Remove.
* features/i386/amd64-avx-mpx-avx512-pku-linux.xml: Remove.
* features/i386/amd64-avx-mpx-avx512-pku.xml: Remove.
* features/i386/amd64-avx-mpx-linux.xml: Remove.
* features/i386/amd64-avx-mpx.xml: Remove.
* features/i386/amd64-avx.xml: Remove.
* features/i386/amd64-linux.xml: Remove.
* features/i386/amd64-mpx-linux.xml: Remove.
* features/i386/amd64-mpx.xml: Remove.
* features/i386/amd64.xml: Remove.
* features/i386/i386-avx-avx512-linux.xml: Remove.
* features/i386/i386-avx-avx512.xml: Remove.
* features/i386/i386-avx-linux.xml: Remove.
* features/i386/i386-avx-mpx-avx512-pku-linux.xml: Remove.
* features/i386/i386-avx-mpx-avx512-pku.xml: Remove.
* features/i386/i386-avx-mpx-linux.xml: Remove.
* features/i386/i386-avx-mpx.xml: Remove.
* features/i386/i386-avx.xml: Remove.
* features/i386/i386-linux.xml: Remove.
* features/i386/i386-mmx-linux.xml: Remove.
* features/i386/i386-mmx.xml: Remove.
* features/i386/i386-mpx-linux.xml: Remove.
* features/i386/i386-mpx.xml: Remove.
* features/i386/i386.xml: Remove.
* features/i386/x32-avx-avx512-linux.xml: Remove.
* features/i386/x32-avx-linux.xml: Remove.
* features/i386/x32-linux.xml: Remove.

4 years agoi386/AArch64: Remove unused .dat files
Alan Hayward [Thu, 4 Jul 2019 10:52:56 +0000 (11:52 +0100)] 
i386/AArch64: Remove unused .dat files

Remove all the dat files that are no longer used by gdbserver.

gdb/ChangeLog:

* regformats/aarch64.dat: Remove.
* regformats/i386/amd64-avx-avx512-linux.dat: Remove.
* regformats/i386/amd64-avx-linux.dat: Remove.
* regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat: Remove.
* regformats/i386/amd64-avx-mpx-linux.dat: Remove.
* regformats/i386/amd64-linux.dat: Remove.
* regformats/i386/amd64-mpx-linux.dat: Remove.
* regformats/i386/amd64.dat: Remove.
* regformats/i386/i386-avx-avx512-linux.dat: Remove.
* regformats/i386/i386-avx-linux.dat: Remove.
* regformats/i386/i386-avx-mpx-avx512-pku-linux.dat: Remove.
* regformats/i386/i386-avx-mpx-linux.dat: Remove.
* regformats/i386/i386-linux.dat: Remove.
* regformats/i386/i386-mmx-linux.dat: Remove.
* regformats/i386/i386-mpx-linux.dat: Remove.
* regformats/i386/i386.dat: Remove.
* regformats/i386/x32-avx-avx512-linux.dat: Remove.
* regformats/i386/x32-avx-linux.dat: Remove.
* regformats/i386/x32-linux.dat: Remove.

4 years agoi386/AArch64: Remove old xml tests
Alan Hayward [Thu, 4 Jul 2019 10:48:16 +0000 (11:48 +0100)] 
i386/AArch64: Remove old xml tests

Both the i386, X86_64 and AArch64 builds of gdbserver include a bunch of legacy
xml files, dat files and auto generated C files, when building for unit test.

These tests exists back from when feature target descriptions were added to
prove that the new target descriptions were identical to the original
older versions. The old files are not used for anything other than these tests.

Now that this has been proven, we are not gaining anything by keeping the
original files and tests. Should new functionality be added, it would break
the tests, unless the functionality was backported to the xml. There is no
requirement that we must match the exact xml from N releases ago.  It adds
obfuscation, where as the feature target descriptions were meant to simplify
the code.

In addition, there are a bunch of xml and dat files which are completely unused.

This patch removes the selftests and the target descriptions from gdbserver.

Update the unittest to allow 0 tests (note, this failed on other targets that
never had any tests).

gdb/ChangeLog:

* aarch64-tdep.c: Remove xml self tests.
* amd64-linux-tdep.c: Likewise.
* amd64-tdep.c: Likewise.
* i386-linux-tdep.c: Likewise.
* i386-tdep.c: Likewise.

gdb/gdbserver/ChangeLog:

* configure.srv: Remove legacy xml.
* linux-aarch64-low.c (initialize_low_arch): Remove
initialize_low_tdesc call.
* linux-aarch64-tdesc-selftest.c: Remove file.
* linux-aarch64-tdesc.h (initialize_low_tdesc): Remove.
* linux-x86-low.c (initialize_low_arch): Remove
initialize_low_tdesc call.
* linux-x86-tdesc-selftest.c: Remove file.
* linux-x86-tdesc.h (initialize_low_tdesc): Remove.

gdb/testsuite/ChangeLog:

* gdb.server/unittest.exp: Allow 0 unit tests to run.

4 years agox86: correct "-Q" option handling
Jan Beulich [Thu, 4 Jul 2019 08:36:41 +0000 (10:36 +0200)] 
x86: correct "-Q" option handling

For another patch I wanted to use a sufficiently benign option (simply
to be able to specify one, which certain test case invocations require),
and I stumbled across -Q in the --help output.  Before realizing that
this is x86-specific anyway, I've tried and and ran into a mysterious
testsuite failure, until I further realized that other than the help
text suggests the option requires an argument.  Correct the help text,
and make the implementation actually match what the comment there has
been describing (and what the help text now says).

4 years agogas/ELF: don't accumulate .type settings
Jan Beulich [Thu, 4 Jul 2019 08:35:47 +0000 (10:35 +0200)] 
gas/ELF: don't accumulate .type settings

Recently a patch was submitted for a Xen Project test harness binary to
override the compiler specified @object to @func (see [1]). In a reply I
suggested we shouldn't make ourselves dependent on currently unspecified
behavior of gas here: It accumulates all requests, and then
bfd/elf.c:swap_out_syms(), in an apparently ad hoc manner, prioritizes
certain flags over others.

Make the behavior predictable: Generally the last .type is what counts.
Exceptions are directives which set multiple bits (TLS, IFUNC, and
UNIQUE): Subsequent directives requesting just the more generic bit
(i.e. FUNC following IFUNC) won't clear the more specific one.  Warn
about incompatible changes, except from/to STT_NOTYPE.

Also add a new target hook, which hppa wants to use right away afaict.

In the course of adding the warning I ran into two ld testsuite
failures.  I can only assume that it was a copy-and-paste mistake that
lead to the same symbol having its type set twice.

[1] https://lists.xenproject.org/archives/html/xen-devel/2019-05/msg01980.html

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 4 Jul 2019 00:00:37 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoFix early return in foreach_with_prefix
Pedro Alves [Wed, 3 Jul 2019 17:05:20 +0000 (18:05 +0100)] 
Fix early return in foreach_with_prefix

I noticed that an early return in a foreach_with_prefix block does not
cause the outer scope to return, like:

  foreach_with_prefix var {"foo" "bar"} {
     return
  }
  # Control continues here, but it should not.

The problem is that we're missing the usual "return -code" treatment.
This commit fixes it.

gdb/testsuite/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

* lib/gdb.exp (foreach_with_prefix): Use "catch" and
"return -code".

4 years agopipe command completer
Pedro Alves [Wed, 3 Jul 2019 15:57:51 +0000 (16:57 +0100)] 
pipe command completer

This commit adds a completer for the "pipe" command.  It can complete
"pipe"'s options, and the specified GDB command.

To make the completer aware of the "-d" option, this converts the
option processing to use gdb::option.

Tests included.

gdb/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

PR cli/24732
* cli/cli-cmds.c (struct pipe_cmd_opts): New.
(pipe_cmd_option_defs): New.
(make_pipe_cmd_options_def_group): New.
(pipe_command): Use gdb::option::process_options.
(pipe_command_completer): New function.
(_initialize_cli_cmds): Install completer for "pipe" command.

gdb/testsuite/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

PR cli/24732
* gdb.base/shell.exp: Load completion-support.exp.
Adjust expected error output.  Add completion tests.

4 years agoFix latent bug in test_gdb_complete_cmd_multiple
Pedro Alves [Wed, 3 Jul 2019 15:57:50 +0000 (16:57 +0100)] 
Fix latent bug in test_gdb_complete_cmd_multiple

A following patch will add the following to a testcase:

  test_gdb_completion_offers_commands "| "

And that tripped on a latent testsuite bug:

 (gdb) | PASS: gdb.base/shell.exp: tab complete "| "
 ^CQuit
 (gdb) complete |
 | !
 | +
 PASS: gdb.base/shell.exp: cmd complete "| "
 |  *** List may be truncated, max-completions reached. ***
 (gdb) FAIL: gdb.base/shell.exp: set max-completions 200
 set max-completions 200

The issue is that "|" ends up as part of a regexp, and "|" in regexps
has a special meaning...

Fix this with string_to_regexp.

gdb/testsuite/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

* lib/completion-support.exp (test_gdb_complete_cmd_multiple): Use
string_to_regexp.

4 years agoTeach gdb::option about string options
Pedro Alves [Wed, 3 Jul 2019 15:57:49 +0000 (16:57 +0100)] 
Teach gdb::option about string options

A following patch will make the "pipe" command use the gdb::option
framework for option processing.  However, "pipe"'s only option today
is a string option, "-d DELIM", and gdb::option does not support
string options yet.

This commit adds support for string options, mapped to var_string.
For now, a string is parsed up until the first whitespace.  I imagine
that we'll need to add support for quoting so that we could do:

 (gdb) cmd -option 'some -string'

without gdb confusing the "-string" for an option.

This doesn't seem important for pipe, so I'm leaving it for another
day.

One thing I'm not happy with, is that the string data is managed as a
raw malloc-allocated char *, which means that we need to xfree it
manually.  This is because var_string settings work that way too.
Although with var_string settings we're leaking the strings at gdb
exit, that was never really a problem.  For options though, leaking is
undesirable.

I think we should tackle that for both settings and options at the
same time, so for now I'm just managing the malloced data manually.
It's a bit ugly in option_def_and_value, but at least that's hidden
from view.

For testing, this adds a new "-string" option to "maint
test-settings", and then tweaks gdb.base/options.exp to exercise it.

gdb/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

* cli/cli-option.c (union option_value) <string>: New field.
(struct option_def_and_value): Add ctor, move ctor, dtor and
use DISABLE_COPY_AND_ASSIGN.
(option_def_and_value::clear_value): New.
(parse_option, save_option_value_in_ctx, get_val_type_str)
(add_setshow_cmds_for_options): Handle var_string.
* cli-option.h (union option_def::var_address) <string>: New
field.
(struct string_option_def): New.
* maint-test-options.c (struct test_options_opts): Add default
ctor and use DISABLE_COPY_AND_ASSIGN.
<string_opt>: New field.
(test_options_opts::~test_options_opts): New.
(test_options_opts::dump): Also dump "-string".
(test_options_option_defs): Install "string.

gdb/testsuite/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

* gdb.base/options.exp (expect_none, expect_flag, expect_bool)
(expect_integer): Adjust to expect "-string".
(expect_string): New.
(all_options): Expect "-string".
(test-flag, test-boolean): Adjust to expect "-string".
(test-string): New proc.
(top level): Call it.

4 years agoMake gdb::option::complete_options save processed arguments too
Pedro Alves [Wed, 3 Jul 2019 15:57:48 +0000 (16:57 +0100)] 
Make gdb::option::complete_options save processed arguments too

Currently, gdb::option::complete_options just discards any processed
option argument, because no completer needs that data.

When completing "pipe -d XXX gdbcmd XXX" however, the completer needs
to know about -d's argument (XXX), in order to know where input is
already past the gdb command and the delimiter.

In this commit, the fix for that is the factoring out of the
save_option_value_in_ctx function and calling it in complete_options.

For testing, this makes "maint show test-options-completion-result"
show the processed options too, like what the "maint test-options"
subcommands output when run.  Then, of course, gdb.base/options.exp is
adjusted.

Doing this exposed a couple latent bugs, which is what the other gdb
changes in the patch are for:

 - in the var_enum case, without the change, we'd end up with a null
   enum argument, and print:

     "-enum (null)"

 - The get_ulongest change is necessary to avoid advancing PP in a
   case where we end up throwing an error, e.g., when parsing "11x".
   Without the change the operand pointer shown by "maint show
   test-options-completion-result" would be left pointing at "x"
   instead of "11x".

gdb/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

* cli/cli-option.c (parse_option) <var_enum>: Don't return an
option_value with a null enumeration.
(complete_options): Save the option values in the context.
(save_option_value_in_ctx): New, factored out from ...
(process_options): ... here.
* cli/cli-utils.c (get_ulongest): Don't advance PP until the end
of the function.
* maint-test-options.c (test_options_opts::dump): New, factored
out from ...
(maintenance_test_options_command_mode): ... here.
(maintenance_test_options_command_completion_result): Delete.
(maintenance_test_options_command_completion_text): Update
comment.
(maintenance_show_test_options_completion_result): Change
prototype.  Just print
maintenance_test_options_command_completion_text.
(save_completion_result): New.
(maintenance_test_options_completer_mode): Pass options context to
complete_options, and then save a dump.
(_initialize_maint_test_options): Use add_cmd to install "maint
show test-options-completion-result".

gdb/testsuite/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

* gdb.base/options.exp (test-misc, test-flag, test-boolean)
(test-uinteger, test-enum): Adjust res_test_gdb_... calls to pass
the expected output in the success.

4 years agoFix test_gdb_complete_tab_multiple race
Pedro Alves [Wed, 3 Jul 2019 15:57:48 +0000 (16:57 +0100)] 
Fix test_gdb_complete_tab_multiple race

Running 'make check-read1 TESTS="gdb.base/options.exp"' revealed a
race in test_gdb_complete_tab_multiple.  There's a gdb_test_multiple
call that expects a prompt in the middle of the regexp.  That's racy
because gdb_test_multiple includes a built-in FAIL pattern for the
prompt, which may match if gdb is slow enough to produce the rest of
the output after the prompt.

Fix this in the usual way of splitting the matching in two.

gdb/testsuite/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

* lib/completion-support.exp (test_gdb_complete_tab_multiple):
Split one gdb_test_multiple call in two to avoid a race.

4 years agoFix assembler tests to work with toolchains that have been configured with --enable...
Nick Clifton [Wed, 3 Jul 2019 14:26:32 +0000 (15:26 +0100)] 
Fix assembler tests to work with toolchains that have been configured with --enable-generate-build-notes.

4 years agoIntroduce the "with" command
Pedro Alves [Wed, 3 Jul 2019 12:34:20 +0000 (13:34 +0100)] 
Introduce the "with" command

( See original discussion and prototype here:
   https://sourceware.org/ml/gdb-patches/2019-05/msg00570.html )

 (gdb) help with
 Temporarily set SETTING to VALUE, run COMMAND, and restore SETTING.
 Usage: with SETTING [VALUE] [-- COMMAND]
 Usage: w SETTING [VALUE] [-- COMMAND]
 With no COMMAND, repeats the last executed command.
 SETTING is any setting you can change with the "set" subcommands.
 E.g.:
   with language pascal -- print obj
   with print elements unlimited -- print obj

As can be seen above, the "with" command is just like "set", but
instead of setting the setting permanently, it sets the setting, runs
a command and then restores the setting.

 (gdb) p g_s
 $1 = {a = 1, b = 2, c = 3}
 (gdb) with language ada -- print g_s
 $2 = (a => 1, b => 2, c => 3)
 Warning: the current language does not match this frame.
 (gdb) show language
 The current source language is "auto; currently c".
 (gdb) with print elements 100 -- with print object on -- print 1
 $3 = 1

You can shorten things a bit though, as long as unambiguous.  So this:

 (gdb) with print elements 100 -- with print object off -- print 1

is the same as:

 (gdb) w p el 100 -- w p o 0 -- p 1

Note that the patch adds a "w" alias for "with", as "w" is not
currently taken:

 (gdb) w
 Ambiguous command "w": watch, wh, whatis, where, while, while-stepping, winheight, ws.

Let me know if you'd prefer to reserve "w" for one of the other
commands above.  IMHO, this command will end up being used frequently
enough that it deserves the "w" shorthand.

A nice feature is that this is fully integrated with TAB-completion:

 (gdb) with p[TAB]
 pagination  print       prompt      python
 (gdb) with print [TAB]
 address                max-depth              static-members
 array                  max-symbolic-offset    symbol
 array-indexes          null-stop              symbol-filename
 asm-demangle           object                 symbol-loading
 demangle               pascal_static-members  thread-events
 elements               pretty                 type
 entry-values           raw                    union
 frame-arguments        repeats                vtbl
 inferior-events        sevenbit-strings
 (gdb) with print [TAB]

 (gdb) with print elements unlimited -- thread apply all -[TAB]
 -ascending  -c          -q          -s

 (gdb) with print elements unlimited -- print -[TAB]
 -address         -max-depth       -repeats         -vtbl
 -array           -null-stop       -static-members
 -array-indexes   -object          -symbol
 -elements        -pretty          -union

The main advantage of this new command compared to command options,
like the new "print -OPT", is that this command works with any
setting, and, it works nicely when you want to override a setting
while running a user-defined command, like:

 (gdb) with print pretty -- usercmd

The disadvantage is that it isn't as compact or easy to type.  I think
of command options and this command as complementary.  I think that
even with this new command, it makes sense to continue developing the
command options in the direction of exposing most-oft-used settings as
command options.

Inspired by Philippe's "/" command proposal, if no command is
specified, then the last command is re-invoked, under the overridden
setting:

 (gdb) p g_s
 $1 = {a = 1, b = 2, c = 3}
 (gdb) with language ada
 $2 = (a => 1, b => 2, c => 3)
 Warning: the current language does not match this frame.

Note: "with" requires "--" to separate the setting from the command.
It might be possible to do without that, but, I haven't tried it yet,
and I think that this can go in without it.  We can always downgrade
to making "--" optional if we manage to make it work.

On to the patch itself, the implementation of the command is simpler
than one might expect.  A few details:

- I factored out a bit from pipe_command into repeat_previous
  directly, because otherwise I'd need to copy&paste the same code and
  same error message in the with command.

- The parse_cli_var_uinteger / parse_cli_var_zuinteger_unlimited /
  do_set_command changes are necessary since we can now pass an empty
  string as argument.

- do_show_command was split in two, as a FIXME comment suggests, but
  for a different reason: we need to get a string version of a "set"
  command's value, and we already had code for that in
  do_show_command.  That code is now factored out to the new
  get_setshow_command_value_string function.

- There's a new "maint with" command added too:

   (gdb) help maint with
   Like "with", but works with "maintenance set" variables.
   Usage: maintenance with SETTING [VALUE] [-- COMMAND]
   With no COMMAND, repeats the last executed command.
   SETTING is any setting you can change with the "maintenance set"
   subcommands.

  "with" and "maint with" share 99% of the implementation.

  This might be useful on its own, but it's also useful for testing,
  since with this, we can use the "maint set/show test-settings"
  settings for exercising the "with" machinery with all the command
  type variants (all enum var_types).  This is done in the new
  gdb/base/with.exp testcase.

The documentation bits are originally based on Philippe's docs for the
"/" command, hence the attribution in the ChangeLog.

gdb/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

* NEWS (New commands): Mention "with" and "maint with".
* cli/cli-cmds.c (with_command_1, with_command_completer_1)
(with_command, with_command_completer): New.
(pipe_command): Adjust to new repeat_previous
interface.
(_initialize_cli_cmds): Install the "with" command and its "w"
alias.
* cli/cli-cmds.h (with_command_1, with_command_completer_1): New
declarations.
* cli/cli-setshow.c (parse_cli_var_uinteger)
(parse_cli_var_zuinteger_unlimited, do_set_command): Handle empty
argument strings for all var_types.
(get_setshow_command_value_string): New, factored out from ...
(do_show_command): ... this.
* cli/cli-setshow.h: Include <string>.
(get_setshow_command_value_string): Declare.
* command.h (repeat_previous): Now returns const char *.  Adjust
comment.
* maint.c: Include "cli/cli-cmds.h".
(maintenance_with_cmd, maintenance_with_cmd_completer): New.
(_initialize_maint_cmds): Register the "maintenance with" command.
* top.c (repeat_previous): Move bits from pipe_command here:
Return the saved command line, if any; error out if there's no
command to relaunch.

gdb/doc/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>
    Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.texinfo (Command Settings): New node documenting the general
concept of settings, how to change them, and the new "with"
command.
(Maintenance Commands): Document "maint with".

gdb/testsuite/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

* gdb.base/with.c: New file.
* gdb.base/with.exp: New file.

4 years ago"maint test-settings set/show" -> "maint set/show test-settings"
Pedro Alves [Wed, 3 Jul 2019 12:34:19 +0000 (13:34 +0100)] 
"maint test-settings set/show" -> "maint set/show test-settings"

This commit renames "maint test-settings set/show" to "maint set/show
test-settings".

This helps the following patch, which introduce a "maint with" command
what works with all "maint set" settings.

gdb/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

* NEWS (New commands): Mention "maint set/show test-settings"
instead of "maint test-settings".
* maint-test-settings.c (maintenance_test_settings_list): Delete.
(maintenance_test_settings_set_list): Rename to ...
(maintenance_set_test_settings_list): ... this.
(maintenance_test_settings_show_list): Rename to  ...
(maintenance_show_test_settings_list): ... this.
(maintenance_test_settings_cmd): Delete.
(maintenance_test_settings_set_cmd): ...
(maintenance_set_test_settings_cmd): ... this.
(maintenance_test_settings_show_cmd): ...
(maintenance_show_test_settings_cmd): ... this.
(maintenance_test_settings_show_value_cmd):
(maintenance_show_test_settings_value_cmd): ... this.
(_initialize_maint_test_settings): No longer install the "maint
test-settings" prefix command.  Rename "maint test-settings set"
to "maint set test-settings", and "maint test-settings show" to
"maint show test-settings".  Adjust all subcommands.

gdb/doc/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

* gdb.texinfo (Maintenance Commands): Document "maint set/show
test-settings" instead of "maint test-settings set/show".

gdb/testsuite/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

* gdb.base/settings.exp: Replace all references to "maint
test-settings set" with references to "maint set test-settings",
and all references to "maint test-settings show" with references
to "maint show test-settings".

4 years agoFix a few comments in maint-test-settings.c
Pedro Alves [Wed, 3 Jul 2019 12:34:18 +0000 (13:34 +0100)] 
Fix a few comments in maint-test-settings.c

Fix the file's intro comment, and s/test-options/test-settings/.

gdb/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

* maint-test-settings.c: Fix file's intro comment.  Replace all
references to "test-options" with references to "test-settings",
in comments.

4 years agoFix defaults of some "maint test-settings" subcommands
Pedro Alves [Wed, 3 Jul 2019 12:34:17 +0000 (13:34 +0100)] 
Fix defaults of some "maint test-settings" subcommands

New tests added later for the incoming "with" command exposed a couple
invalid-default-value bugs in the "maint test-settings" commands:

- var_filename commands don't allow setting the filename to the empty
  string (unlike var_optional_filename commands), yet, "maint
  test-settings filename"'s control variable was not initialized, so
  on startup, "maint test-settings show filename" shows an empty
  string.

- "maint test-settings enum"'s control variable was not initialized,
  so on startup, "maint test-settings show enum" shows an empty value
  instead of a valid enum value.

Both issues are fixed by initializing the control variables.

gdb/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

* maint-test-settings.c (maintenance_test_settings_xxx)
(maintenance_test_settings_yyy, maintenance_test_settings_zzz):
New.
(maintenance_test_settings_enums): Use them.
(maintenance_test_settings_enum): Default to
maintenance_test_settings_xxx.
(_initialize_maint_test_settings): Initialize
MAINTENANCE_TEST_SETTINGS_FILENAME.

gdb/testsuite/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

* gdb.base/settings.exp (test-string): Adjust expected out when
testing "maint test-settings show filename"

4 years agoRemove return value from remove_breakpoints_inf
Simon Marchi [Wed, 3 Jul 2019 02:03:09 +0000 (22:03 -0400)] 
Remove return value from remove_breakpoints_inf

... since nobody uses it.

gdb/ChangeLog:

* breakpoint.h (remove_breakpoints_inf): Change return type to
void, move function documentation here.
* breakpoint.c (remove_breakpoints_inf): Change return type to
void, move function documentation to header.

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 3 Jul 2019 00:00:24 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoMake "info threads" use the gdb::option framework
Pedro Alves [Tue, 2 Jul 2019 15:34:31 +0000 (16:34 +0100)] 
Make "info threads" use the gdb::option framework

This makes "info threads" use the gdb::option framework to process
options.  There's only one option today (-gid), and it isn't used much
frequently unless you're looking at matching MI output.  Still, this
was in the neighborhood of "thread apply" so I had converted it.

The main advantage is that TAB completion now shows you the available
options, and gives you a hint to what the command accepts as operand
argument, including showing a metasyntactic variable:

  (gdb) info threads [TAB]
  -gid  ID

  (gdb) help info threads
  Display currently known threads.
  Usage: info threads [OPTION]... [ID]...

  Options:
    -gid
      Show global thread IDs.

  If ID is given, it is a space-separated list of IDs of threads to display.
  Otherwise, all threads are displayed.
  (gdb)

gdb/ChangeLog:
2019-07-02  Pedro Alves  <palves@redhat.com>

* NEWS (Completion improvements): Mention "info threads".
* thread.c (struct info_threads_opts, info_threads_option_defs)
(make_info_threads_options_def_group): New.
(info_threads_command): Use gdb::option::process_options.
(info_threads_command_completer): New.
(_initialize_thread): Use gdb::option::build_help to build the
help text for "info threads".

gdb/testsuite/ChangeLog:
2019-07-02  Pedro Alves  <palves@redhat.com>

* gdb.base/options.exp (test-info-threads): New procedure.
(top level): Call it.

4 years agoStop the BFD library from issuing a warning message when processing allocated section...
Nick Clifton [Tue, 2 Jul 2019 14:58:29 +0000 (15:58 +0100)] 
Stop the BFD library from issuing a warning message when processing allocated sections in debuginfo files that lie outside of any loadable segment.

PR 24717
* elf.c (is_debuginfo_file): New function.
(assign_file_positions_for_non_load_sections): Do not warn about
allocated sections outside of loadable segments if they are found
in a debuginfo file.
* elf-bfd.h (is_debuginfo_file): Prototype.

4 years agoMove generic_load declaration to symfile.h
Simon Marchi [Tue, 2 Jul 2019 14:30:46 +0000 (10:30 -0400)] 
Move generic_load declaration to symfile.h

... since the implementation is in symfile.c.

At the same time, add some documentation and make sure the first
parameter's name in the declaration matches the definition.

gdb/ChangeLog:

* defs.h (generic_load): Move from here...
* symfile.h (generic_load): ... to here.  Rename name parameter
to args.
* symfile.c (generic_load): Add comment.

4 years agoFix a bug recently introduced to the linker where it would complain about a section...
Nick Clifton [Tue, 2 Jul 2019 13:14:13 +0000 (14:14 +0100)] 
Fix a bug recently introduced to the linker where it would complain about a section being larger than a file, even if the section was artificial.

PR 24753
bfd * compress.c (bfd_get_full_section_contents): Do not complain
about linker created sections that are larger than the file size.

ld * emultempl/aarch64elf.em (_aarch64_add_stub_section): Include the
LINKER_CREATED section flag when creating the stub section.

4 years agoThis patch fixes a bug in the AArch64 assembler where an incorrect structural load...
Barnaby Wilks [Tue, 2 Jul 2019 13:09:52 +0000 (14:09 +0100)] 
This patch fixes a bug in the AArch64 assembler where an incorrect structural load/store by element instruction would generate the wrong error message.

For example, when provided with the (incorrect) instruction

st4 {v0.16b-v3.16b}[4],[x0]

currently assembler provides the following error message
"Error: comma expected between operands at operand 2 -- `st4 {v0.16b-v3.16b}[4],[x0]'".

This was due to the assembler consuming the {v0.16b-v3.16b} as the first operand leaving
[4],[x0] as what it believed to be the second operand.

The actual error is that the first operand should be of element type and not
vector type (as provided). The new diagnostic for this error is
"Error: expected element type rather than vector type at operand 1 -- `st4 {v0.16b-v3.16b}[4],[x0]'.

Added testcases to check for the correct diagnostic message as well as checking that
variations of the structural load/store by element instruction also generate the error
when they have the same problem.

* config/tc-aarch64.c (parse_operands): Add error check.
* testsuite/gas/aarch64/diagnostic.l: New test.
* testsuite/gas/aarch64/diagnostic.s: New test.
* testsuite/gas/aarch64/illegal.l: New tests.
* testsuite/gas/aarch64/illegal.s: New tests.

4 years agoPR ld/24709 [arm] linker crash and assertion failure with CMSE
Christophe Lyon [Tue, 2 Jul 2019 13:09:02 +0000 (13:09 +0000)] 
PR ld/24709 [arm] linker crash and assertion failure with CMSE

As discussed in the PR, we do not support the case where CMSE stubs
are inserted too far from their destination. This would require an
intermediate long-branch stub, which is tricky in this context.

Instead of crashing, this patch emit an error message and exits.

2019-07-02  Christophe Lyon  <christophe.lyon@linaro.org>

* bfd/elf32-arm.c (CMSE_STUB_NAME): New define.
(elf32_arm_get_stub_entry): Do not try to emit long-branch stubs
for CMSE stubs.
(arm_dedicated_stub_output_section_name): Use CMSE_STUB_NAME.

Change-Id: I6d4e1c0fdee6bb9f4b07e5e1b46700b5ba31c62e

4 years agoEnsure that debug information is retained for ARMv8-M security functions.
Srinath Parvathaneni [Tue, 2 Jul 2019 11:43:59 +0000 (12:43 +0100)] 
Ensure that debug information is retained for ARMv8-M security functions.

Consider a file containing only Armv8-M secure entry functions.
This file is compiled and linked with "-march=armv8-m.main -mfloat-abi=hard
-mfpu=fpv5-sp-d16 -mcmse -static --specs=rdimon.specs
-Wl,--section-start,.gnu.sgstubs=0x190000 -ffunction-sections
-fdata-sections
-Wl,--gc-sections -g" options to generate an executable.

The executable generated does not contain any debug information of these
secure entry functions even though it contains secure entry functions in
the .text section.  This patch fixes this problem.

4 years ago[AArch64] Allow MOVPRFX to be used with FMOV
Richard Sandiford [Tue, 2 Jul 2019 09:52:16 +0000 (10:52 +0100)] 
[AArch64] Allow MOVPRFX to be used with FMOV

The entry for the FMOV alias of FCPY was missing C_SCAN_MOVPRFX.
(The entry for FCPY itself was OK.)

This was the only /m-predicated instruction I could see that was
missing the flag.

2019-07-02  Richard Sandiford  <richard.sandiford@arm.com>

opcodes/
* aarch64-tbl.h (aarch64_opcode): Set C_SCAN_MOVPRFX for the
SVE FMOV alias of FCPY.

gas/
* testsuite/gas/aarch64/sve-movprfx_27.s,
* testsuite/gas/aarch64/sve-movprfx_27.d: New test.

4 years ago[AArch64] Add missing C_MAX_ELEM flags for SVE conversions
Richard Sandiford [Tue, 2 Jul 2019 09:51:09 +0000 (10:51 +0100)] 
[AArch64] Add missing C_MAX_ELEM flags for SVE conversions

SVE FCVTZS, FCVTZU, SCVTF and UCVTF need the same treatment as FCVT:
the register size used in a predicated MOVPRFX must be the wider of
the destination and source sizes.

Since I was adding a (supposedly) complete set of tests for converts,
it seemed more consistent to add a complete set of tests for shifts
as well, even though there's no bug to fix there.

2019-07-02  Richard Sandiford  <richard.sandiford@arm.com>

opcodes/
* aarch64-tbl.h (aarch64_opcode_table): Add C_MAX_ELEM flags
to SVE fcvtzs, fcvtzu, scvtf and ucvtf entries.

gas/
* testsuite/gas/aarch64/sve-movprfx_26.s: Also test FCVTZS, FCVTZU,
SCVTF, UCVTF, LSR and ASR.
* testsuite/gas/aarch64/sve-movprfx_26.d: Update accordingly.
* testsuite/gas/aarch64/sve-movprfx_26.l: Likewise.

4 years ago[AArch64] Fix bogus MOVPRFX warning for GPR form of CPY
Richard Sandiford [Tue, 2 Jul 2019 09:51:05 +0000 (10:51 +0100)] 
[AArch64] Fix bogus MOVPRFX warning for GPR form of CPY

One of the MOVPRFX tests has:

  output register of preceding `movprfx' used as input at operand 3 -- `cpy z1.d,p1/m,x1'

But X1 and Z1 are not the same register, so the instruction is
actually OK.

2019-07-02  Richard Sandiford  <richard.sandiford@arm.com>

opcodes/
* aarch64-opc.c (verify_constraints): Skip GPRs when scanning the
registers in an instruction prefixed by MOVPRFX.

gas/
* testsuite/gas/aarch64/sve-movprfx_25.s: Allow CPY Z1.D.P1/M,X1
to be prefixed by MOVPRFX.
* testsuite/gas/aarch64/sve-movprfx_25.d: Update accordingly.
* testsuite/gas/aarch64/sve-movprfx_25.l: Likewise.

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 2 Jul 2019 00:00:38 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAvoid use-after-free in DWARF debug names code
Tom Tromey [Mon, 1 Jul 2019 15:33:19 +0000 (09:33 -0600)] 
Avoid use-after-free in DWARF debug names code

A static analyzer pointed out that find_vec_in_debug_names will use
the contents of a unique_ptr after it has been destroyed.  This patch
fixes the bug by hoisting the declaration into the appropriate
enclosing block.

I'm checking this in as obvious.

gdb/ChangeLog
2019-07-01  Tom Tromey  <tromey@adacore.com>

* dwarf2read.c
(dw2_debug_names_iterator::find_vec_in_debug_names): Hoist
declaration of without_params.  Fix formatting.

4 years agoFix bug when generating REL type relocs for assembler generated build notes.
Nick Clifton [Mon, 1 Jul 2019 15:19:14 +0000 (16:19 +0100)] 
Fix bug when generating REL type relocs for assembler generated build notes.

PR 24748
* write.c (create_note_reloc): Add desc2_offset parameter.  Change
name of offset parameter to note_offset.  Only use desc2_offset
when placing addend into REL reloc's address space.
(maybe_generate_build_notes): Update parameters passed to
create_note_reloc.

4 years ago[gas][aarch64][SVE2] Fix pmull{t,b} requirement on SVE2-AES
Matthew Malcomson [Mon, 1 Jul 2019 14:17:22 +0000 (15:17 +0100)] 
[gas][aarch64][SVE2] Fix pmull{t,b} requirement on SVE2-AES

I had mistakenly given all variants of the new SVE2 instructions
pmull{t,b} a dependency on the feature +sve2-aes.

Only the variant specifying .Q -> .D  sizes should have that
restriction.

This patch fixes that mistake and updates the testsuite to have extra
tests (matching the given set of tests per line in aarch64-tbl.h that
the rest of the SVE2 tests follow).

We also add a line in the documentation of the command line to clarify
how to enable `pmull{t,b}` of this larger size.  This is needed because
all other instructions gated under the `sve2-aes` architecture extension
are marked in the instruction documentation by an `HaveSVE2AES` check
while pmull{t,b} is gated under the `HaveSVE2PMULL128` check.

Regtested targeting aarch64-linux.

gas/ChangeLog:

2019-07-01  Matthew Malcomson  <matthew.malcomson@arm.com>

* testsuite/gas/aarch64/illegal-sve2-aes.d: Update tests.
* testsuite/gas/aarch64/illegal-sve2.l: Update tests.
* doc/c-aarch64.texi: Add special note of pmull{t,b}
instructions under the sve2-aes architecture extension.
* testsuite/gas/aarch64/illegal-sve2.s: Add small size
pmull{t,b} instructions.
* testsuite/gas/aarch64/sve2.d: Add small size pmull{t,b}
disassembly.
* testsuite/gas/aarch64/sve2.s: Add small size pmull{t,b}
instructions.

include/ChangeLog:

2019-07-01  Matthew Malcomson  <matthew.malcomson@arm.com>

* opcode/aarch64.h (enum aarch64_insn_class): sve_size_013
renamed to sve_size_13.

opcodes/ChangeLog:

2019-07-01  Matthew Malcomson  <matthew.malcomson@arm.com>

* aarch64-asm.c (aarch64_encode_variant_using_iclass): Use new
sve_size_13 icode to account for variant behaviour of
pmull{t,b}.
* aarch64-dis-2.c: Regenerate.
* aarch64-dis.c (aarch64_decode_variant_using_iclass): Use new
sve_size_13 icode to account for variant behaviour of
pmull{t,b}.
* aarch64-tbl.h (OP_SVE_VVV_HD_BS): Add new qualifier.
(OP_SVE_VVV_Q_D): Add new qualifier.
(OP_SVE_VVV_QHD_DBS): Remove now unused qualifier.
(struct aarch64_opcode): Split pmull{t,b} into those requiring
AES and those not.

4 years agoRemove is_a_field_of_this from ada_lookup_symbol
Tom Tromey [Thu, 27 Jun 2019 15:05:17 +0000 (09:05 -0600)] 
Remove is_a_field_of_this from ada_lookup_symbol

All callers of ada_lookup_symbol pass NULL for the
"is_a_field_of_this" parameter, so remove it.

gdb/ChangeLog
2019-07-01  Tom Tromey  <tromey@adacore.com>

* ada-exp.y (find_primitive_type): Update.
* ada-lang.h (ada_lookup_symbol): Update.
* ada-lang.c (ada_lookup_symbol): Remove "is_a_field_of_this"
parameter.
(ada_lookup_encoded_symbol, ada_lookup_symbol_nonlocal): Update.

4 years agoDocument the .value directive supported by the x86 and x86_64 assemblers.
Nick Clifton [Mon, 1 Jul 2019 11:39:09 +0000 (12:39 +0100)] 
Document the .value directive supported by the x86 and x86_64 assemblers.

PR 24738
* doc/c-i386.texi (i386-Directives): Add a description of the
Value directive.

4 years agoCorrect a typo in the description of the Align and P2align directives.
Nick Clifton [Mon, 1 Jul 2019 11:24:46 +0000 (12:24 +0100)] 
Correct a typo in the description of the Align and P2align directives.

PR 24737
* doc/as.texi (Align): Add missing word to description of
pseudo-op.
(P2align): Likewise.

4 years agoCorrect the calculation of offsets for ARM exidx relocs when performing a partial...
Nick Clifton [Mon, 1 Jul 2019 10:17:01 +0000 (11:17 +0100)] 
Correct the calculation of offsets for ARM exidx relocs when performing a partial link.

PR 23839
bfd * elf32-arm.c (elf32_arm_update_relocs): Do not include the
section VMA in the offset used to update exidx relocs.

ld * testsuite/ld-arm/unwind-4.d: Adjust for corrected calculation of
exidx relocs.

4 years agolibctf: fix spurious error when rolling back to the first snapshot
Nick Alcock [Fri, 28 Jun 2019 21:11:14 +0000 (22:11 +0100)] 
libctf: fix spurious error when rolling back to the first snapshot

The first ctf_snapshot called after CTF file creation yields a snapshot
handle that always yields a spurious ECTF_OVERROLLBACK error ("Attempt
to roll back past a ctf_update") on ctf_rollback(), even if ctf_update
has never been called.

The fix is to start with a ctf_snapshot value higher than the zero value
that ctf_snapshot_lu ("last update CTF snapshot value") is initialized
to.

libctf/
* ctf-create.c (ctf_create): Fix off-by-one error.

4 years agolibctf: deduplicate and sort the string table
Nick Alcock [Thu, 27 Jun 2019 12:51:10 +0000 (13:51 +0100)] 
libctf: deduplicate and sort the string table

ctf.h states:

> [...] the CTF string table does not contain any duplicated strings.

Unfortunately this is entirely untrue: libctf has before now made no
attempt whatsoever to deduplicate the string table. It computes the
string table's length on the fly as it adds new strings to the dynamic
CTF file, and ctf_update() just writes each string to the table and
notes the current write position as it traverses the dynamic CTF file's
data structures and builds the final CTF buffer.  There is no global
view of the strings and no deduplication.

Fix this by erasing the ctf_dtvstrlen dead-reckoning length, and adding
a new dynhash table ctf_str_atoms that maps unique strings to a list
of references to those strings: a reference is a simple uint32_t * to
some value somewhere in the under-construction CTF buffer that needs
updating to note the string offset when the strtab is laid out.

Adding a string is now a simple matter of calling ctf_str_add_ref(),
which adds a new atom to the atoms table, if one doesn't already exist,
and adding the location of the reference to this atom to the refs list
attached to the atom: this works reliably as long as one takes care to
only call ctf_str_add_ref() once the final location of the offset is
known (so you can't call it on a temporary structure and then memcpy()
that structure into place in the CTF buffer, because the ref will still
point to the old location: ctf_update() changes accordingly).

Generating the CTF string table is a matter of calling
ctf_str_write_strtab(), which counts the length and number of elements
in the atoms table using the ctf_dynhash_iter() function we just added,
populating an array of pointers into the atoms table and sorting it into
order (to help compressors), then traversing this table and emitting it,
updating the refs to each atom as we go.  The only complexity here is
arranging to keep the null string at offset zero, since a lot of code in
libctf depends on being able to leave strtab references at 0 to indicate
'no name'.  Once the table is constructed and the refs updated, we know
how long it is, so we can realloc() the partial CTF buffer we allocated
earlier and can copy the table on to the end of it (and purge the refs
because they're not needed any more and have been invalidated by the
realloc() call in any case).

The net effect of all this is a reduction in uncompressed strtab sizes
of about 30% (perhaps a quarter to a half of all strings across the
Linux kernel are eliminated as duplicates). Of course, duplicated
strings are highly redundant, so the space saving after compression is
only about 20%: when the other non-strtab sections are factored in, CTF
sizes shrink by about 10%.

No change in externally-visible API or file format (other than the
reduction in pointless redundancy).

libctf/
* ctf-impl.h: (struct ctf_strs_writable): New, non-const version of
struct ctf_strs.
(struct ctf_dtdef): Note that dtd_data.ctt_name is unpopulated.
(struct ctf_str_atom): New, disambiguated single string.
(struct ctf_str_atom_ref): New, points to some other location that
references this string's offset.
(struct ctf_file): New members ctf_str_atoms and ctf_str_num_refs.
Remove member ctf_dtvstrlen: we no longer track the total strlen
as we add strings.
(ctf_str_create_atoms): Declare new function in ctf-string.c.
(ctf_str_free_atoms): Likewise.
(ctf_str_add): Likewise.
(ctf_str_add_ref): Likewise.
(ctf_str_purge_refs): Likewise.
(ctf_str_write_strtab): Likewise.
(ctf_realloc): Declare new function in ctf-util.c.

* ctf-open.c (ctf_bufopen): Create the atoms table.
(ctf_file_close): Destroy it.
* ctf-create.c (ctf_update): Copy-and-free it on update.  No longer
special-case the position of the parname string.  Construct the
strtab by calling ctf_str_add_ref and ctf_str_write_strtab after the
rest of each buffer element is constructed, not via open-coding:
realloc the CTF buffer and append the strtab to it.  No longer
maintain ctf_dtvstrlen.  Sort the variable entry table later, after
strtab construction.
(ctf_copy_membnames): Remove: integrated into ctf_copy_{s,l,e}members.
(ctf_copy_smembers): Drop the string offset: call ctf_str_add_ref
after buffer element construction instead.
(ctf_copy_lmembers): Likewise.
(ctf_copy_emembers): Likewise.
(ctf_create): No longer maintain the ctf_dtvstrlen.
(ctf_dtd_delete): Likewise.
(ctf_dvd_delete): Likewise.
(ctf_add_generic): Likewise.
(ctf_add_enumerator): Likewise.
(ctf_add_member_offset): Likewise.
(ctf_add_variable): Likewise.
(membadd): Likewise.
* ctf-util.c (ctf_realloc): New, wrapper around realloc that aborts
if there are active ctf_str_num_refs.
(ctf_strraw): Move to ctf-string.c.
(ctf_strptr): Likewise.
* ctf-string.c: New file, strtab manipulation.

* Makefile.am (libctf_a_SOURCES): Add it.
* Makefile.in: Regenerate.

4 years agolibctf: add hash traversal helpers
Nick Alcock [Thu, 27 Jun 2019 12:30:22 +0000 (13:30 +0100)] 
libctf: add hash traversal helpers

There are two, ctf_dynhash_iter and ctf_dynhash_iter_remove: the latter
lets you return a nonzero value to remove the element being iterated
over.

Used in the next commit.

libctf/
* ctf-impl.h (ctf_hash_iter_f): New.
(ctf_dynhash_iter): New declaration.
(ctf_dynhash_iter_remove): New declaration.
* ctf-hash.c (ctf_dynhash_iter): Define.
(ctf_dynhash_iter_remove): Likewise.
(ctf_hashtab_traverse): New.
(ctf_hashtab_traverse_remove): Likewise.
(struct ctf_traverse_cb_arg): Likewise.
(struct ctf_traverse_remove_cb_arg): Likewise.

4 years agolibctf: fix hash removal
Nick Alcock [Fri, 28 Jun 2019 20:58:31 +0000 (21:58 +0100)] 
libctf: fix hash removal

We must call htab_remove_elt with an element (in this case, a mocked-up
one with only the key populated, since no reasonable hash function will
need the other fields), not with the key alone.

libctf/
* ctf-hash.c (ctf_dynhash_remove): Call with a mocked-up element.

4 years agolibctf: disambiguate hex output in dumps
Nick Alcock [Thu, 27 Jun 2019 12:15:37 +0000 (13:15 +0100)] 
libctf: disambiguate hex output in dumps

We were sometimes printing hex values without prefixing them with '0x',
leading to confusion about what base the numbers were actually in.

libctf/
* ctf-dump.c (ctf_dump_format_type): Prefix hex strings with 0x.
(ctf_dump_funcs): Likewise.

4 years agoFix spelling error in assembler documentation.
Nick Clifton [Mon, 1 Jul 2019 09:20:43 +0000 (10:20 +0100)] 
Fix spelling error in assembler documentation.

4 years agox86: drop Vec_Imm4
Jan Beulich [Mon, 1 Jul 2019 06:38:50 +0000 (08:38 +0200)] 
x86: drop Vec_Imm4

It is pretty wasteful to have a per-operand flag which is used in
exactly 4 cases. It can be relatively easily replaced, and by doing so
I've actually found some dead code to remove at the same time (there's
no case of ImmExt set at the same time as Vec_Imm4).

This page took 0.061946 seconds and 4 git commands to generate.