Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
... 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.
|
|
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.
|
|
|
|
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.
|
|
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.
|
|
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)
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
*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.
|
|
aarch64-pauth.c was slightly out of sync with the generated version.
Regenerate it.
gdb/ChangeLog:
* features/aarch64-pauth.c: Regenerate.
|
|
gdb/ChangeLog:
* breakpoint.h (struct bpstat_what) <is_longjmp>: Change type to
bool.
(bpstat_what): Use false instead of 0.
|
|
|
|
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.
|
|
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"'.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
|
|
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.
|
|
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.
|
|
PR 24785
* elf32-ppc.c (_bfd_elf_ppc_set_arch): Sanity check .PPC.EMB.apuinfo
size before reading first word.
|
|
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.
|
|
|
|
|
|
|
|
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.
|
|
|