Age | Commit message (Collapse) | Author | Files | Lines |
|
When running gdb.server/server-connect.exp I run into:
...
FAIL: gdb.server/server-connect.exp: tcp6: connect to gdbserver using tcp6:::1
FAIL: gdb.server/server-connect.exp: tcp6-with-brackets: connect to gdbserver \
using tcp6:[::1]
FAIL: gdb.server/server-connect.exp: udp6: connect to gdbserver using udp6:::1
FAIL: gdb.server/server-connect.exp: udp6-with-brackets: connect to gdbserver \
using udp6:[::1]
...
The FAIL is caused by the fact that the ipv6 loopback address is not available:
...
PASS: gdb.server/server-connect.exp: tcp6: start gdbserver
target remote tcp6:::1:2347^M
A program is being debugged already. Kill it? (y or n) y^M
tcp6:::1:2347: Network is unreachable.^M
(gdb) FAIL: gdb.server/server-connect.exp: tcp6: connect to gdbserver using tcp6:::1
...
This should be marked UNSUPPORTED rather than FAIL.
Furthermore, the test-case takes about 4 minutes, because the 'Network is
unreachable' response is not explicitly handled in gdb_target_cmd, so instead
it runs into the timeout case.
Fix this by handling the 'Network is unreachable' response as UNSUPPORTED.
This reduces testing time from 4 minutes to about 2 seconds.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-09-19 Tom de Vries <tdevries@suse.de>
* lib/gdbserver-support.exp (gdb_target_cmd_ext): Return 2 (meaning
UNSUPPORTED) for 'Network is unreachable' message. Factor out of ...
(gdb_target_cmd): ... here.
* gdb.server/server-connect.exp: Use gdb_target_cmd_ext, handle return
value 2.
|
|
... to include PR breakpoints/24541 (for documentation purposes).
For the reader's convenience, the commit in question was the following:
commit 677052f2a5c67f1d9b2e6d1b2a2149b5f0c20cd0
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Thu May 16 16:23:24 2019 -0400
Subject: Make stap-probe.c:stap_parse_register_operand's "regname"
an std::string
|
|
Readline 8.0 has a feature that lets an application name a keymap.
This in turn makes it simpler for users to bind keys in keymaps in
their .inputrc.
This patch gives a name to the TUI SingleKey keymap, so that
additional bindings can be made there. For example:
$if gdb
set keymap SingleKey
"X": "echo hello\\n\n"
$endif
The call to rl_initialize, in tui_initialize_readline, had to be
removed so that .inputrc was not read too early. Note that Readline
explicitly documents that this call is not needed.
gdb/ChangeLog
2019-09-18 Tom Tromey <tom@tromey.com>
* NEWS: Add entry.
* tui/tui.c (tui_initialize_readline): Set name of keymap. Do not
call rl_initialize.
(tui_enable): Do not call rl_initialize.
gdb/doc/ChangeLog
2019-09-18 Tom Tromey <tom@tromey.com>
* gdb.texinfo (Editing): Document readline application name.
(TUI Single Key Mode): Document TUI SingleKey keymap name.
|
|
Fixes:
CXX alpha-linux-nat.o
alpha-linux-nat.c: In member function 'virtual CORE_ADDR alpha_linux_nat_target::register_u_offset(gdbarch*, int, int)':
alpha-linux-nat.c:93:16: error: 'gdbarch_pc_regnum' was not declared in this scope
if (regno == gdbarch_pc_regnum (gdbarch))
^~~~~~~~~~~~~~~~~
alpha-linux-nat.c:93:16: note: suggested alternative: 'gdbarch_info'
if (regno == gdbarch_pc_regnum (gdbarch))
^~~~~~~~~~~~~~~~~
gdbarch_info
alpha-linux-nat.c:97:15: error: 'gdbarch_fp0_regnum' was not declared in this scope
if (regno < gdbarch_fp0_regnum (gdbarch))
^~~~~~~~~~~~~~~~~~
alpha-linux-nat.c:97:15: note: suggested alternative: 'gdbarch_info'
if (regno < gdbarch_fp0_regnum (gdbarch))
^~~~~~~~~~~~~~~~~~
gdbarch_info
make[2]: *** [Makefile:1638: alpha-linux-nat.o] Error 1
make[2]: Leaving directory '/home/chris/tmp/binutils-gdb/gdb'
2019-09-12 Christian Groessler <chris@groessler.org>
* alpha-linux-nat.c: Include gdbarch.h.
|
|
Following the int -> bool conversion of boolean options (commit
491144b5e21b ("Change boolean options to bool instead of int")), I see
this ASAN error:
==357543==ERROR: AddressSanitizer: global-buffer-overflow on address 0x55555b25d440 at pc 0x5555583ce9e1 bp 0x7fffffffd390 sp 0x7fffffffd380
READ of size 4 at 0x55555b25d440 thread T0
#0 0x5555583ce9e0 in term_cli_styling /home/simark/src/binutils-gdb/gdb/ui-file.c:111
#1 0x5555583cf8b0 in stdio_file::can_emit_style_escape() /home/simark/src/binutils-gdb/gdb/ui-file.c:308
#2 0x5555584450d2 in set_output_style /home/simark/src/binutils-gdb/gdb/utils.c:1442
#3 0x5555584491af in fprintf_styled(ui_file*, ui_file_style const&, char const*, ...) /home/simark/src/binutils-gdb/gdb/utils.c:2143
#4 0x5555582fa13c in print_gdb_version(ui_file*, bool) /home/simark/src/binutils-gdb/gdb/top.c:1339
#5 0x555557b723ab in captured_main_1 /home/simark/src/binutils-gdb/gdb/main.c:981
#6 0x555557b7353b in captured_main /home/simark/src/binutils-gdb/gdb/main.c:1172
#7 0x555557b735d0 in gdb_main(captured_main_args*) /home/simark/src/binutils-gdb/gdb/main.c:1197
#8 0x55555700a53d in main /home/simark/src/binutils-gdb/gdb/gdb.c:32
#9 0x7ffff64c9ee2 in __libc_start_main (/usr/lib/libc.so.6+0x26ee2)
#10 0x55555700a30d in _start (/home/simark/build/binutils-gdb/gdb/gdb+0x1ab630d)
0x55555b25d441 is located 0 bytes to the right of global variable 'cli_styling' defined in '/home/simark/src/binutils-gdb/gdb/cli/cli-style.c:31:6' (0x55555b25d440) of size 1
The reason of this is that we have this declaration of cli_styling in cli/cli-style.h:
extern bool cli_styling;
but ui-file.c uses its own local declaration:
extern int cli_styling;
Because of that, the code in ui-file.c thinks the variable is 4 bytes
long, when it is actually 1 byte long, so the generated code reads past
the variable.
Fix it by removing the declaration and making ui-file.c include
cli/cli-style.h.
gdb/ChangeLog:
* ui-file.c: Include cli/cli-style.h.
(term_cli_styling): Remove cli_styling declaration.
|
|
Give a test an actual name in order to avoid having a directory name
in the .sum file.
gdb/testsuite/ChangeLog:
* gdb.base/source-dir.exp: Avoid having directory names in test
names.
|
|
The main point of this patch is to give bfd_get_section a better name,
bfd_asymbol_section.
bfd/
* bfd-in.h (bfd_asymbol_section): Rename from bfd_get_section.
(bfd_get_output_section): Delete.
(bfd_asymbol_base): Delete.
(bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name),
(bfd_asymbol_bfd, bfd_asymbol_flavour): Tidy.
(bfd_set_asymbol_name): New macro.
* bfd-in2.h: Regenerate.
* aout-cris.c: Update throughout to use bfd_asymbol_section.
* aoutx.h: Likewise.
* cofflink.c: Likewise.
* dwarf2.c: Likewise.
* ecoff.c: Likewise.
* elf.c: Likewise.
* elf32-arm.c: Likewise.
* elf32-mips.c: Likewise.
* elf32-score.c: Likewise.
* elf32-score7.c: Likewise.
* elfn32-mips.c: Likewise.
* elfnn-aarch64.c: Likewise.
* elfxx-mips.c: Likewise.
* linker.c: Likewise.
* pdp11.c: Likewise.
* elf64-mmix.c (mmix_elf_reloc): Expand bfd_get_output_section.
binutils/
* nm.c: Update bfd_get_section to bfd_asymbol_section throughout.
* objcopy.c: Likewise.
* objdump.c: Likewise.
* rdcoff.c: Likewise.
* objcopy.c (create_new_symbol): Use bfd_set_asymbol_name.
(filter_symbols): Likewise.
gas/
* symbols.c (S_IS_LOCAL): Update bfd_get_section to
bfd_asymbol_section.
gdb/
* arm-tdep.c (arm_record_special_symbol): Update bfd_get_section
to bfd_asymbol_section.
ld/
* ldcref.c (check_reloc_refs): Update bfd_get_section to
bfd_asymbol_section.
|
|
bfd/
* bfd-in.h (carsym.name): Make const.
* reloc.c (struct reloc_howto_struct.name): Likewise.
* targets.c (bfd_target.name): Likewise.!
* bfd.c (bfd_get_sign_extend_vma): Make variable const.
* som.c (som_bfd_fill_in_ar_symbols): Use an intermediary variable
when setting carsym.name.
* bfd-in2.h: Regenerate.
gdb/
* amd64-dicos-tdep.c (amd64_dicos_osabi_sniffer): Constify target.
* i386-cygwin-tdep.c (i386_cygwin_init_abi): Likewise.
* i386-dicos-tdep.c (i386_dicos_osabi_sniffer): Likewise.
ld/
* ldlang.c (stricpy, strcut, name_compare): Constify params.
(get_first_input_target): Make return and "target" const.
|
|
Fixes a few leaks in bfd and ld.
bfd/
* mach-o.c (bfd_mach_o_fat_member_init): Likewise. Replace
xstrdup and xmalloc with bfd_strdup and bfd_malloc. Return an
error status. Adjust calls.
* vms-lib.c (_bfd_vms_lib_get_module): Test mhd->id earlier.
Close bfd on failure. Replace xstrdup/bfd_alloc use with
bfd_malloc. Use bfd_set_filename.
gdb/
* solib-spu.c (spu_bfd_open): Use bfd_set_filename.
* spu-linux-nat.c (spu_bfd_open): Likewise.
ld/
* emultempl/pe.em (after_open): Use bfd_set_filename.
* emultempl/pep.em (after_open): Use bfd_set_filename.
|
|
This was an oversight in 491144b5e21bbfd41969c175aebb663976f59058;
dwarf2loc.c has an extern definition for dwarf_always_disassemble
that I missed. This patch updates it from int to bool to match
the definition in dwarf2read.c.
gdb/ChangeLog:
2019-09-18 Christian Biesinger <cbiesinger@google.com>
* dwarf2loc.c: Change extern declaration of dwarf_always_disassemble
to bool to match definition in dwarf2read.c.
|
|
This is for add_setshow_boolean_cmd as well as the gdb::option interface.
gdb/ChangeLog:
2019-09-17 Christian Biesinger <cbiesinger@google.com>
* ada-lang.c (ada_ignore_descriptive_types_p): Change to bool.
(print_signatures): Likewise.
(trust_pad_over_xvs): Likewise.
* arch/aarch64-insn.c (aarch64_debug): Likewise.
* arch/aarch64-insn.h (aarch64_debug): Likewise.
* arm-linux-nat.c (arm_apcs_32): Likewise.
* arm-linux-tdep.c (arm_apcs_32): Likewise.
* arm-nbsd-nat.c (arm_apcs_32): Likewise.
* arm-tdep.c (arm_debug): Likewise.
(arm_apcs_32): Likewise.
* auto-load.c (debug_auto_load): Likewise.
(auto_load_gdb_scripts): Likewise.
(global_auto_load): Likewise.
(auto_load_local_gdbinit): Likewise.
(auto_load_local_gdbinit_loaded): Likewise.
* auto-load.h (global_auto_load): Likewise.
(auto_load_local_gdbinit): Likewise.
(auto_load_local_gdbinit_loaded): Likewise.
* breakpoint.c (disconnected_dprintf): Likewise.
(breakpoint_proceeded): Likewise.
(automatic_hardware_breakpoints): Likewise.
(always_inserted_mode): Likewise.
(target_exact_watchpoints): Likewise.
(_initialize_breakpoint): Update.
* breakpoint.h (target_exact_watchpoints): Change to bool.
* btrace.c (maint_btrace_pt_skip_pad): Likewise.
* cli/cli-cmds.c (trace_commands): Likewise.
* cli/cli-cmds.h (trace_commands): Likewise.
* cli/cli-decode.c (add_setshow_boolean_cmd): Change int* argument
to bool*.
* cli/cli-logging.c (logging_overwrite): Change to bool.
(logging_redirect): Likewise.
(debug_redirect): Likewise.
* cli/cli-option.h (option_def) <boolean>: Change return type to bool*.
(struct boolean_option_def) <get_var_address_cb_>: Change return type
to bool.
<boolean_option_def>: Update.
(struct flag_option_def): Change default type of Context to bool
from int.
<flag_option_def>: Change return type of var_address_cb_ to bool*.
* cli/cli-setshow.c (do_set_command): Cast to bool* instead of int*.
(get_setshow_command_value_string): Likewise.
* cli/cli-style.c (cli_styling): Change to bool.
(source_styling): Likewise.
* cli/cli-style.h (source_styling): Likewise.
(cli_styling): Likewise.
* cli/cli-utils.h (struct qcs_flags) <quiet, cont, silent>: Change
to bool.
* command.h (var_types): Update comment.
(add_setshow_boolean_cmd): Change int* var argument to bool*.
* compile/compile-cplus-types.c (debug_compile_cplus_types): Change to
bool.
(debug_compile_cplus_scopes): Likewise.
* compile/compile-internal.h (compile_debug): Likewise.
* compile/compile.c (compile_debug): Likewise.
(struct compile_options) <raw>: Likewise.
* cp-support.c (catch_demangler_crashes): Likewise.
* cris-tdep.c (usr_cmd_cris_version_valid): Likewise.
(usr_cmd_cris_dwarf2_cfi): Likewise.
* csky-tdep.c (csky_debug): Likewise.
* darwin-nat.c (enable_mach_exceptions): Likewise.
* dcache.c (dcache_enabled_p): Likewise.
* defs.h (info_verbose): Likewise.
* demangle.c (demangle): Likewise.
(asm_demangle): Likewise.
* dwarf-index-cache.c (debug_index_cache): Likewise.
* dwarf2-frame.c (dwarf2_frame_unwinders_enabled_p): Likewise.
* dwarf2-frame.h (dwarf2_frame_unwinders_enabled_p): Likewise.
* dwarf2read.c (check_physname): Likewise.
(use_deprecated_index_sections): Likewise.
(dwarf_always_disassemble): Likewise.
* eval.c (overload_resolution): Likewise.
* event-top.c (set_editing_cmd_var): Likewise.
(exec_done_display_p): Likewise.
* event-top.h (set_editing_cmd_var): Likewise.
(exec_done_display_p): Likewise.
* exec.c (write_files): Likewise.
* fbsd-nat.c (debug_fbsd_lwp): Likewise
(debug_fbsd_nat): Likewise.
* frame.h (struct frame_print_options) <print_raw_frame_arguments>:
Likewise.
(struct set_backtrace_options) <backtrace_past_main>: Likewise.
<backtrace_past_entry> Likewise.
* gdb-demangle.h (demangle): Likewise.
(asm_demangle): Likewise.
* gdb_bfd.c (bfd_sharing): Likewise.
* gdbcore.h (write_files): Likewise.
* gdbsupport/common-debug.c (show_debug_regs): Likewise.
* gdbsupport/common-debug.h (show_debug_regs): Likewise.
* gdbthread.h (print_thread_events): Likewise.
* gdbtypes.c (opaque_type_resolution): Likewise.
(strict_type_checking): Likewise.
* gnu-nat.c (gnu_debug_flag): Likewise.
* guile/scm-auto-load.c (auto_load_guile_scripts): Likewise.
* guile/scm-param.c (pascm_variable): Add boolval.
(add_setshow_generic): Update.
(pascm_param_value): Update.
(pascm_set_param_value_x): Update.
* hppa-tdep.c (hppa_debug): Change to bool..
* infcall.c (may_call_functions_p): Likewise.
(coerce_float_to_double_p): Likewise.
(unwind_on_signal_p): Likewise.
(unwind_on_terminating_exception_p): Likewise.
* infcmd.c (startup_with_shell): Likewise.
* inferior.c (print_inferior_events): Likewise.
* inferior.h (startup_with_shell): Likewise.
(print_inferior_events): Likewise.
* infrun.c (step_stop_if_no_debug): Likewise.
(detach_fork): Likewise.
(debug_displaced): Likewise.
(disable_randomization): Likewise.
(non_stop): Likewise.
(non_stop_1): Likewise.
(observer_mode): Likewise.
(observer_mode_1): Likewise.
(set_observer_mode): Update.
(sched_multi): Change to bool.
* infrun.h (debug_displaced): Likewise.
(sched_multi): Likewise.
(step_stop_if_no_debug): Likewise.
(non_stop): Likewise.
(disable_randomization): Likewise.
* linux-tdep.c (use_coredump_filter): Likewise.
(dump_excluded_mappings): Likewise.
* linux-thread-db.c (auto_load_thread_db): Likewise.
(check_thread_db_on_load): Likewise.
* main.c (captured_main_1): Update.
* maint-test-options.c (struct test_options_opts) <flag_opt, xx1_opt,
xx2_opt, boolean_opt>: Change to bool.
* maint-test-settings.c (maintenance_test_settings_boolean): Likewise.
* maint.c (maintenance_profile_p): Likewise.
(per_command_time): Likewise.
(per_command_space): Likewise.
(per_command_symtab): Likewise.
* memattr.c (inaccessible_by_default): Likewise.
* mi/mi-main.c (mi_async): Likewise.
(mi_async_1): Likewise.
* mips-tdep.c (mips64_transfers_32bit_regs_p): Likewise.
* nat/fork-inferior.h (startup_with_shell): Likewise.
* nat/linux-namespaces.c (debug_linux_namespaces): Likewise.
* nat/linux-namespaces.h (debug_linux_namespaces): Likewise.
* nios2-tdep.c (nios2_debug): Likewise.
* or1k-tdep.c (or1k_debug): Likewise.
* parse.c (parser_debug): Likewise.
* parser-defs.h (parser_debug): Likewise.
* printcmd.c (print_symbol_filename): Likewise.
* proc-api.c (procfs_trace): Likewise.
* python/py-auto-load.c (auto_load_python_scripts): Likewise.
* python/py-param.c (union parmpy_variable): Add "bool boolval" field.
(set_parameter_value): Update.
(add_setshow_generic): Update.
* python/py-value.c (copy_py_bool_obj): Change argument from int*
to bool*.
* python/python.c (gdbpy_parameter_value): Cast to bool* instead of
int*.
* ravenscar-thread.c (ravenscar_task_support): Change to bool.
* record-btrace.c (record_btrace_target::store_registers): Update.
* record-full.c (record_full_memory_query): Change to bool.
(record_full_stop_at_limit): Likewise.
* record-full.h (record_full_memory_query): Likewise.
* remote-notif.c (notif_debug): Likewise.
* remote-notif.h (notif_debug): Likewise.
* remote.c (use_range_stepping): Likewise.
(interrupt_on_connect): Likewise.
(remote_break): Likewise.
* ser-tcp.c (tcp_auto_retry): Likewise.
* ser-unix.c (serial_hwflow): Likewise.
* skip.c (debug_skip): Likewise.
* solib-aix.c (solib_aix_debug): Likewise.
* spu-tdep.c (spu_stop_on_load_p): Likewise.
(spu_auto_flush_cache_p): Likewise.
* stack.c (struct backtrace_cmd_options) <full, no_filters, hide>:
Likewise.
(struct info_print_options) <quiet>: Likewise.
* symfile-debug.c (debug_symfile): Likewise.
* symfile.c (auto_solib_add): Likewise.
(separate_debug_file_debug): Likewise.
* symfile.h (auto_solib_add): Likewise.
(separate_debug_file_debug): Likewise.
* symtab.c (basenames_may_differ): Likewise.
(struct filename_partial_match_opts) <dirname, basename>: Likewise.
(struct info_print_options) <quiet, exclude_minsyms>: Likewise.
(struct info_types_options) <quiet>: Likewise.
* symtab.h (demangle): Likewise.
(basenames_may_differ): Likewise.
* target-dcache.c (stack_cache_enabled_1): Likewise.
(code_cache_enabled_1): Likewise.
* target.c (trust_readonly): Likewise.
(may_write_registers): Likewise.
(may_write_memory): Likewise.
(may_insert_breakpoints): Likewise.
(may_insert_tracepoints): Likewise.
(may_insert_fast_tracepoints): Likewise.
(may_stop): Likewise.
(auto_connect_native_target): Likewise.
(target_stop_and_wait): Update.
(target_async_permitted): Change to bool.
(target_async_permitted_1): Likewise.
(may_write_registers_1): Likewise.
(may_write_memory_1): Likewise.
(may_insert_breakpoints_1): Likewise.
(may_insert_tracepoints_1): Likewise.
(may_insert_fast_tracepoints_1): Likewise.
(may_stop_1): Likewise.
* target.h (target_async_permitted): Likewise.
(may_write_registers): Likewise.
(may_write_memory): Likewise.
(may_insert_breakpoints): Likewise.
(may_insert_tracepoints): Likewise.
(may_insert_fast_tracepoints): Likewise.
(may_stop): Likewise.
* thread.c (struct info_threads_opts) <show_global_ids>: Likewise.
(make_thread_apply_all_options_def_group): Change argument from int*
to bool*.
(thread_apply_all_command): Update.
(print_thread_events): Change to bool.
* top.c (confirm): Likewise.
(command_editing_p): Likewise.
(history_expansion_p): Likewise.
(write_history_p): Likewise.
(info_verbose): Likewise.
* top.h (confirm): Likewise.
(history_expansion_p): Likewise.
* tracepoint.c (disconnected_tracing): Likewise.
(circular_trace_buffer): Likewise.
* typeprint.c (print_methods): Likewise.
(print_typedefs): Likewise.
* utils.c (debug_timestamp): Likewise.
(sevenbit_strings): Likewise.
(pagination_enabled): Likewise.
* utils.h (sevenbit_strings): Likewise.
(pagination_enabled): Likewise.
* valops.c (overload_resolution): Likewise.
* valprint.h (struct value_print_options) <prettyformat_arrays,
prettyformat_structs, vtblprint, unionprint, addressprint, objectprint,
stop_print_at_null, print_array_indexes, deref_ref, static_field_print,
pascal_static_field_print, raw, summary, symbol_print, finish_print>:
Likewise.
* windows-nat.c (new_console): Likewise.
(cygwin_exceptions): Likewise.
(new_group): Likewise.
(debug_exec): Likewise.
(debug_events): Likewise.
(debug_memory): Likewise.
(debug_exceptions): Likewise.
(useshell): Likewise.
* windows-tdep.c (maint_display_all_tib): Likewise.
* xml-support.c (debug_xml): Likewise.
|
|
The 'directory' command allows the user to provide a list of filesystem
directories in which to search for source code. The directories in this
search path are used as the base directory for the source filename from
the debug information (DW_AT_name). Thus the directory search path
provides alternatives to the existing compilation directory from the
debug information (DW_AT_comp_dir). Generally speaking, DW_AT_name
stores the filename argument passed to the compiler (including any
directory components), and DW_AT_comp_dir stores the current working
directory from which the compiler was executed. For example:
$ cd /path/to/project/subdir1
$ gcc -c a/test.c -g
The corresponding debug information will look like this:
DW_AT_name : a/test.c
DW_AT_comp_dir : /path/to/project/subdir1
When compiling with the -fdebug-prefix-map GCC option, the compilation
directory can be arbitrarily rewritten. In the above example, we may
rewrite the compilation directory as follows:
$ gcc -c a/test.c -g -fdebug-prefix-map=/path/to/project=
In this case, the corresponding debug information will look like:
DW_AT_name : a/test.c
DW_AT_comp_dir : /subdir1
This prevents GDB from finding the corresponding source code based on
the debug information alone. In some cases, a substitute-path command
can be used to re-map a consistent prefix in the rewritten compilation
directory to the real filesystem path. However, there may not be a
consistent prefix remaining in the debug symbols (for example in a
project that has source code in many subdirectories under the project's
root), thereby requiring multiple substitute-path rules. In this case,
it is easier to add the missing prefix to the directory search path via
the 'directory' command.
The function find_and_open_source currently searches in:
SEARCH_PATH/FILENAME
where SEARCH_PATH corresponds to each individual entry in the directory
search path (which is guaranteed to contain the compilation directory
from the debug information, as well as the current working directory).
FILENAME corresponds to the source filename (DW_AT_name), which may have
directory components in it. In addition, GDB searches in:
SEARCH_PATH/FILE_BASENAME
where FILE_BASENAME is the basename of the DW_AT_name entry.
This change modifies find_and_open_source to additionally search in:
SEARCH_PATH/COMP_DIR/FILENAME
where COMP_DIR is the compilation directory from the debug symbols. In
the example given earlier, running:
(gdb) directory /path/to/project
will now allow GDB to correctly locate the source code from the debug
information.
gdb/ChangeLog:
* source.c (prepare_path_for_appending): New function.
(openp): Make use of new function.
(find_and_open_source): Search for the compilation directory and
source file as a relative path beneath the directory search path.
gdb/doc/ChangeLog:
* gdb.texinfo (Source Path): Additional text to better describe
how the source path directory list is used when searching for
source files.
gdb/testsuite/ChangeLog:
* gdb.base/source-dir.exp: Add extra test for mapped compilation
directory.
|
|
The source_cache::get_line_charpos function can currently throw an
exception if the source file is missing, which doesn't match the
expected behaviour documented in the functions header file. The
documented behaviour is to return false on failure, and this is how
the function appears to be used throughout GDB.
I spotted this in the 'info source' command, currently for a missing
source file you'll see something like this:
(gdb) info source
Current source file is /path/to/src/file.c
Compilation directory is /path/to/build/
/path/to/src/file.c: No such file or directory.
(gdb)
After this patch we see this:
(gdb) info source
Current source file is /path/to/src/file.c
Compilation directory is /path/to/build/
Source language is c.
Producer is COMPILER VERSION AND FLAGS.
Compiled with DWARF 2 debugging format.
Does not include preprocessor macro info.
We don't currently indicate that the source file can't be found, and
maybe that would be something worth adding in the future.
gdb/ChangeLog:
* source-cache.c (source_cache::get_line_charpos): Catch
exceptions and return false, this matches the behaviour documented
in the header file.
gdb/testsuite/ChangeLog:
* gdb.base/list-missing-source.exp: New file.
|
|
A recent change enhanced a couple of notifications about Ada tasks to
include the task's name in addition to the task's number. That change
also modified the output of the "info tasks" when printing the detailed
information of one given task. I believe this change was unintentionally
left over from the initial version after it was decided that quoting
the task's name should not be done. This patch therefore undoes this
part of the patch.
gdb/ChangeLog:
* ada-tasks.c (info_task): Remove quoting of the task's name.
Tested on x86_64-linux, with both the official testsuite as well as
AdaCore's testsuite.
|
|
This just replaces the comment in the .c file with
"See symfile.h.".
gdb/ChangeLog:
2019-09-16 Christian Biesinger <cbiesinger@google.com>
* symfile.c (auto_solib_add): Replace comment with a reference
to the header file.
|
|
This was fixed in commit 272044897e178835f596c96740c5a1800ec6f9fb.
2019-09-14 Christian Biesinger <cbiesinger@google.com>
* NEWS: Mention that gdb can now be compiled with Python 3
on Windows.
|
|
When running gdb.ada/rename_subscript_param.exp with gnatmake 7.4.1, we get:
...
FAIL: gdb.ada/rename_subscript_param.exp: print rename_subscript_param_b \
before changing its value
FAIL: gdb.ada/rename_subscript_param.exp: print rename_subscript_param_b \
after changing its value
...
The commit last touching the test-case (afcfda091e) states:
...
The test still fails with old compilers that do not properly
generate debug info for this renaming:
...
Fix this by requiring at least gnatmake 8 for the test-case.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-09-14 Tom de Vries <tdevries@suse.de>
PR teststuite/24599
* gdb.ada/rename_subscript_param.exp: Require gnatmake 8.
* lib/ada.exp (gnatmake_version_at_least): New proc.
|
|
This commit:
commit aa17805fb9a3a1983a510ba425b682fba03410c2
Date: Sat Aug 31 23:44:40 2019 +0100
gdb: Have 'maint info sections' print all sections again
introduced a use of log10 that took an int as a parameter.
Unfortunately this was causing a compilation error on Solaris, see:
https://sourceware.org/ml/gdb-patches/2019-09/msg00230.html
https://sourceware.org/ml/gdb-patches/2019-09/msg00231.html
because there was only a float, double, or long double version of
log10, and the compiler doesn't know which to choose.
This commit should resolve this issue by casting the argument to
float.
gdb/ChangeLog:
* maint.c (maint_print_section_data::maint_print_section_data):
Force use of 'float log10 (float)' by casting the argument to
float.
|
|
Make use of exec_has_index_section library function rather than
manually checking in the 'maintenance info sections' output. Should
make no difference to the test results, just makes the code easier to
read.
gdb/testsuite/ChangeLog:
* gdb.base/maint.exp: Use exec_has_index_section.
|
|
In this commit:
commit 6eac171f0624303d944ff1a1ae4d0e3b0a63c800
Date: Fri Aug 16 00:25:14 2019 +0200
[gdb] Make maint info sections print relocated addresses
A couple of things broke with the 'maintenance info sections' command,
here is some before output:
(gdb) maintenance info sections
Exec file:
`/path/to/gdb/build/gdb/testsuite/outputs/gdb.base/maint/maint',
file type elf64-x86-64.
[0] 0x00400238->0x00400254 at 0x00000238: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS
[1] 0x00400254->0x00400274 at 0x00000254: .note.ABI-tag ALLOC LOAD READONLY DATA HAS_CONTENTS
[2] 0x00400274->0x00400298 at 0x00000274: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS
[3] 0x00400298->0x004002bc at 0x00000298: .gnu.hash ALLOC LOAD READONLY DATA HAS_CONTENTS
[4] 0x004002c0->0x00400380 at 0x000002c0: .dynsym ALLOC LOAD READONLY DATA HAS_CONTENTS
[5] 0x00400380->0x004003e3 at 0x00000380: .dynstr ALLOC LOAD READONLY DATA HAS_CONTENTS
[6] 0x004003e4->0x004003f4 at 0x000003e4: .gnu.version ALLOC LOAD READONLY DATA HAS_CONTENTS
[7] 0x004003f8->0x00400418 at 0x000003f8: .gnu.version_r ALLOC LOAD READONLY DATA HAS_CONTENTS
[8] 0x00400418->0x00400460 at 0x00000418: .rela.dyn ALLOC LOAD READONLY DATA HAS_CONTENTS
[9] 0x00400460->0x004004c0 at 0x00000460: .rela.plt ALLOC LOAD READONLY DATA HAS_CONTENTS
[10] 0x004004c0->0x004004d7 at 0x000004c0: .init ALLOC LOAD READONLY CODE HAS_CONTENTS
[11] 0x004004e0->0x00400530 at 0x000004e0: .plt ALLOC LOAD READONLY CODE HAS_CONTENTS
[12] 0x00400530->0x00400802 at 0x00000530: .text ALLOC LOAD READONLY CODE HAS_CONTENTS
[13] 0x00400804->0x0040080d at 0x00000804: .fini ALLOC LOAD READONLY CODE HAS_CONTENTS
[14] 0x00400810->0x0040084e at 0x00000810: .rodata ALLOC LOAD READONLY DATA HAS_CONTENTS
[15] 0x00400850->0x004008c4 at 0x00000850: .eh_frame_hdr ALLOC LOAD READONLY DATA HAS_CONTENTS
[16] 0x004008c8->0x00400ab8 at 0x000008c8: .eh_frame ALLOC LOAD READONLY DATA HAS_CONTENTS
[17] 0x00600e00->0x00600e08 at 0x00000e00: .init_array ALLOC LOAD DATA HAS_CONTENTS
[18] 0x00600e08->0x00600e10 at 0x00000e08: .fini_array ALLOC LOAD DATA HAS_CONTENTS
[19] 0x00600e10->0x00600ff0 at 0x00000e10: .dynamic ALLOC LOAD DATA HAS_CONTENTS
[20] 0x00600ff0->0x00601000 at 0x00000ff0: .got ALLOC LOAD DATA HAS_CONTENTS
[21] 0x00601000->0x00601038 at 0x00001000: .got.plt ALLOC LOAD DATA HAS_CONTENTS
[22] 0x00601038->0x0060103c at 0x00001038: .data ALLOC LOAD DATA HAS_CONTENTS
[23] 0x00601040->0x006012c8 at 0x0000103c: .bss ALLOC
[24] 0x00000000->0x0000002c at 0x0000103c: .comment READONLY HAS_CONTENTS
[25] 0x00000000->0x00000060 at 0x00001068: .debug_aranges READONLY HAS_CONTENTS
[26] 0x00000000->0x0000061b at 0x000010c8: .debug_info READONLY HAS_CONTENTS
[27] 0x00000000->0x00000264 at 0x000016e3: .debug_abbrev READONLY HAS_CONTENTS
[28] 0x00000000->0x000001e6 at 0x00001947: .debug_line READONLY HAS_CONTENTS
[29] 0x00000000->0x00000487 at 0x00001b2d: .debug_str READONLY HAS_CONTENTS
(gdb)
And here is the output after the above commit:
(gdb) maintenance info sections
+maintenance info sections
Exec file:
`/path/to/gdb/build/gdb/testsuite/outputs/gdb.base/maint/maint',
file type elf64-x86-64.
0x00400238->0x00400254 at 0x00000238: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS
0x00400254->0x00400274 at 0x00000254: .note.ABI-tag ALLOC LOAD READONLY DATA HAS_CONTENTS
0x00400274->0x00400298 at 0x00000274: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS
0x00400298->0x004002bc at 0x00000298: .gnu.hash ALLOC LOAD READONLY DATA HAS_CONTENTS
0x004002c0->0x00400380 at 0x000002c0: .dynsym ALLOC LOAD READONLY DATA HAS_CONTENTS
0x00400380->0x004003e3 at 0x00000380: .dynstr ALLOC LOAD READONLY DATA HAS_CONTENTS
0x004003e4->0x004003f4 at 0x000003e4: .gnu.version ALLOC LOAD READONLY DATA HAS_CONTENTS
0x004003f8->0x00400418 at 0x000003f8: .gnu.version_r ALLOC LOAD READONLY DATA HAS_CONTENTS
0x00400418->0x00400460 at 0x00000418: .rela.dyn ALLOC LOAD READONLY DATA HAS_CONTENTS
0x00400460->0x004004c0 at 0x00000460: .rela.plt ALLOC LOAD READONLY DATA HAS_CONTENTS
0x004004c0->0x004004d7 at 0x000004c0: .init ALLOC LOAD READONLY CODE HAS_CONTENTS
0x004004e0->0x00400530 at 0x000004e0: .plt ALLOC LOAD READONLY CODE HAS_CONTENTS
0x00400530->0x00400802 at 0x00000530: .text ALLOC LOAD READONLY CODE HAS_CONTENTS
0x00400804->0x0040080d at 0x00000804: .fini ALLOC LOAD READONLY CODE HAS_CONTENTS
0x00400810->0x0040084e at 0x00000810: .rodata ALLOC LOAD READONLY DATA HAS_CONTENTS
0x00400850->0x004008c4 at 0x00000850: .eh_frame_hdr ALLOC LOAD READONLY DATA HAS_CONTENTS
0x004008c8->0x00400ab8 at 0x000008c8: .eh_frame ALLOC LOAD READONLY DATA HAS_CONTENTS
0x00600e00->0x00600e08 at 0x00000e00: .init_array ALLOC LOAD DATA HAS_CONTENTS
0x00600e08->0x00600e10 at 0x00000e08: .fini_array ALLOC LOAD DATA HAS_CONTENTS
0x00600e10->0x00600ff0 at 0x00000e10: .dynamic ALLOC LOAD DATA HAS_CONTENTS
0x00600ff0->0x00601000 at 0x00000ff0: .got ALLOC LOAD DATA HAS_CONTENTS
0x00601000->0x00601038 at 0x00001000: .got.plt ALLOC LOAD DATA HAS_CONTENTS
0x00601038->0x0060103c at 0x00001038: .data ALLOC LOAD DATA HAS_CONTENTS
0x00601040->0x006012c8 at 0x0000103c: .bss ALLOC
0x00000000->0x00000000 at 0x00000000: *COM* IS_COMMON
0x00000000->0x00000000 at 0x00000000: *UND*
0x00000000->0x00000000 at 0x00000000: *ABS*
0x00000000->0x00000000 at 0x00000000: *IND*
(gdb)
We lost the section index numbers, but more importantly, we lost the
information about the .debug* sections. We also gained entries for
the "fake" sections *COM*, *UND*, *ABS*, and *IND*.
I noticed this when running:
make check-gdb RUNTESTFLAGS="--target_board=cc-with-gdb-index gdb.base/maint.exp"
As this test relies on looking in the 'maint info sections' output to
see if we have a .debug_names or .gdb_index section, and these are
debug sections so they no longer show up in the 'main info sections'
output, the gdb.base/maint.exp test fails.
This commit restores the old behaviour while keeping the important
change that the above commit introduced, the addresses printed for
sections are the relocated addresses where appropriate. The above
commit mentions using this test:
make check-gdb RUNTESTFLAGS="CFLAGS_FOR_TARGET='-pie' gdb.base/compare-sections.exp"
And this still passes after this commit.
The output for 'maint info sections' now looks like this:
(gdb) maintenance info sections
Exec file:
`/home/andrew/projects/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/maint/maint',
file type elf64-x86-64.
[0] 0x00400238->0x00400254 at 0x00000238: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS
[1] 0x00400254->0x00400274 at 0x00000254: .note.ABI-tag ALLOC LOAD READONLY DATA HAS_CONTENTS
[2] 0x00400274->0x00400298 at 0x00000274: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS
[3] 0x00400298->0x004002bc at 0x00000298: .gnu.hash ALLOC LOAD READONLY DATA HAS_CONTENTS
[4] 0x004002c0->0x00400380 at 0x000002c0: .dynsym ALLOC LOAD READONLY DATA HAS_CONTENTS
[5] 0x00400380->0x004003e3 at 0x00000380: .dynstr ALLOC LOAD READONLY DATA HAS_CONTENTS
[6] 0x004003e4->0x004003f4 at 0x000003e4: .gnu.version ALLOC LOAD READONLY DATA HAS_CONTENTS
[7] 0x004003f8->0x00400418 at 0x000003f8: .gnu.version_r ALLOC LOAD READONLY DATA HAS_CONTENTS
[8] 0x00400418->0x00400460 at 0x00000418: .rela.dyn ALLOC LOAD READONLY DATA HAS_CONTENTS
[9] 0x00400460->0x004004c0 at 0x00000460: .rela.plt ALLOC LOAD READONLY DATA HAS_CONTENTS
[10] 0x004004c0->0x004004d7 at 0x000004c0: .init ALLOC LOAD READONLY CODE HAS_CONTENTS
[11] 0x004004e0->0x00400530 at 0x000004e0: .plt ALLOC LOAD READONLY CODE HAS_CONTENTS
[12] 0x00400530->0x00400802 at 0x00000530: .text ALLOC LOAD READONLY CODE HAS_CONTENTS
[13] 0x00400804->0x0040080d at 0x00000804: .fini ALLOC LOAD READONLY CODE HAS_CONTENTS
[14] 0x00400810->0x0040084e at 0x00000810: .rodata ALLOC LOAD READONLY DATA HAS_CONTENTS
[15] 0x00400850->0x004008c4 at 0x00000850: .eh_frame_hdr ALLOC LOAD READONLY DATA HAS_CONTENTS
[16] 0x004008c8->0x00400ab8 at 0x000008c8: .eh_frame ALLOC LOAD READONLY DATA HAS_CONTENTS
[17] 0x00600e00->0x00600e08 at 0x00000e00: .init_array ALLOC LOAD DATA HAS_CONTENTS
[18] 0x00600e08->0x00600e10 at 0x00000e08: .fini_array ALLOC LOAD DATA HAS_CONTENTS
[19] 0x00600e10->0x00600ff0 at 0x00000e10: .dynamic ALLOC LOAD DATA HAS_CONTENTS
[20] 0x00600ff0->0x00601000 at 0x00000ff0: .got ALLOC LOAD DATA HAS_CONTENTS
[21] 0x00601000->0x00601038 at 0x00001000: .got.plt ALLOC LOAD DATA HAS_CONTENTS
[22] 0x00601038->0x0060103c at 0x00001038: .data ALLOC LOAD DATA HAS_CONTENTS
[23] 0x00601040->0x006012c8 at 0x0000103c: .bss ALLOC
[24] 0x00000000->0x0000002c at 0x0000103c: .comment READONLY HAS_CONTENTS
[25] 0x00000000->0x00000060 at 0x00001068: .debug_aranges READONLY HAS_CONTENTS
[26] 0x00000000->0x0000061b at 0x000010c8: .debug_info READONLY HAS_CONTENTS
[27] 0x00000000->0x00000264 at 0x000016e3: .debug_abbrev READONLY HAS_CONTENTS
[28] 0x00000000->0x000001e6 at 0x00001947: .debug_line READONLY HAS_CONTENTS
[29] 0x00000000->0x00000487 at 0x00001b2d: .debug_str READONLY HAS_CONTENTS
(gdb)
This is basically as it was before, except that the index numbers are
now padded so the section information all lines up.
When GDB has relocated a section then the relocated addresses will be
printed, otherwise the non-relocated addresses from the bfd will be
printed.
I've added a test to gdb.base/maint.exp to do some basic validation of
the output format.
gdb/ChangeLog:
* maint.c: Add 'cmath' include.
(struct maint_print_section_data): New structure.
(print_section_index): New function.
(print_bfd_section_info): Add header comment, small whitespace
cleanup, and update to call new print_section_index function.
(print_objfile_section_info): Likewise.
(maint_obj_section_from_bfd_section): New function.
(print_bfd_section_info_maybe_relocated): New function.
(maintenance_info_sections): Add header comment, always use
bfd_map_over_sections instead of ALL_OBJFILE_OSECTIONS.
gdb/testsuite/ChangeLog:
* gdb.base/maint.exp: Add test for 'maint info sections'.
|
|
I found that these tests:
make check-gdb RUNTESTFLAGS="--target_board=cc-with-gdb-index gdb.base/maint.exp"
make check-gdb RUNTESTFLAGS="--target_board=cc-with-debug-names gdb.base/maint.exp"
were causing GDB to segfault. It turns out that this test runs this
command:
maint print psymbols -pc main /path/to/some/file
which tries to lookup the partial_symtab for 'main'. The problem is
that there is no partial_symtab for 'main' as we are using the
.gdb_index or .debug_names instead of partial_symtabs.
What happens is that maintenance_print_symbols calls
find_pc_sect_psymtab, which looks for the partial_symtab in the
objfile's objfile->partial_symtabs->psymtabs_addrmap.
This is a problem because when we are using the indexes
psymtabs_addrmap is reused to hold things other than partial_symtabs,
this can be seen in dwarf2read.c in create_addrmap_from_index and
create_addrmap_from_aranges. If we then lookup in psymtabs_addrmap we
end up returning a pointer to something that isn't really a
partial_symtab, after which everything goes wrong.
Initially I simply added a check at the start of find_pc_sect_psymtab
that the objfile had some partial_symtabs, like:
if (objfile->partial_symtabs->psymtabs == NULL)
return NULL;
Figuring that if there were no partial_symtabs at all then this
function should always return NULL, however, this caused a failure in
the test gdb.python/py-event.exp which I didn't dig into too deeply,
but seems to be that in this tests there are initially no psymtabs,
but the second part of find_pc_sect_psymtab does manage to read some
in from somewhere, with the check I added the test fails as we
returned NULL here and this caused GDB to load in the full symtabs
earlier than was expected.
Instead I chose to guard only the access to psymtabs_addrmap with a
check that the function has some psymtabs. This allows my original
tests to pass, and the py-event.exp test to pass too.
Now, a good argument can be made that we simply should never call
find_pc_sect_psymtab on an objfile that is using indexes instead of
partial_symtabs. I did consider this approach, we could easily add an
assert into find_pc_sect_psymtab that if we find a partial_symtab in
psymtabs_addrmap then the psymtabs pointer must be non-null. The
responsibility would then be on the user of find_pc_sect_psymtab to
ensure that the objfile being checked is suitable. In the end I
didn't take this approach as the check in find_pc_sect_psymtab is
cheap and this ensures that any future miss-uses of the function will
not cause problems.
I also extended the comment on psymtabs_addrmap to indicate that it
holds more than just partial_symtabs as this was not at all clear from
the original comment, and caused me some confusion when I was
initially debugging this problem.
gdb/ChangeLog:
* psymtab.c (find_pc_sect_psymtab): Move baseaddr local into more
inner scope, add check that the objfile has psymtabs before
checking psymtabs_addrmap.
* psymtab.h (psymtab_storage) <psymtabs_addrmap>: Extend comment.
|
|
The test-case gdb.base/store.exp fails with gcc 7.4.0:
...
nr of unexpected failures 27
...
The first FAIL:
...
110 l = add_float (l, r);
(gdb) PASS: gdb.base/store.exp: continue to wack_float
print l
$21 = <optimized out>
FAIL: gdb.base/store.exp: var float l; print old l, expecting -1
...
relates to this bit in the test-case (compiled at -O0):
...
106 float
107 wack_float (register float u, register float v)
108 {
109 register float l = u, r = v;
110 l = add_float (l, r);
111 return l + r;
112 }
...
and it expects to be able to read and modify variable l before executing line
110, but it already fails to read the value, because l has no DW_AT_location
attribute in the debug info.
Variable l is declared with the register keyword, and GCC implements the
register keyword at -O0 like so:
...
the compiler allocates distinct stack memory for all variables that do not
have the register storage-class specifier; if register is specified, the
variable may have a shorter lifespan than the code would indicate and may
never be placed in memory.
...
The fact that l has no DW_AT_location attribute, matches with the documented
"variable may have a shorter lifespan that code would indicate", (though it
is the most extreme case of it) so the gcc behaviour is valid. We can of
course improve gcc to generate better debuginfo (filed gcc PR91611), but
this not a wrong-debug problem.
[ The test-case passes with gcc 4.2.1, but for the failing test discussed
above, it passes simply because it doesn't store l in a register. ]
With the debug info missing for l, reading and setting l is unsupported, so
fix the FAIL by marking the test UNSUPPORTED instead.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-09-12 Tom de Vries <tdevries@suse.de>
* gdb.base/store.exp: Allow register variables to be optimized out at
-O0.
|
|
With this patch, we e.g. get:
[Switching to task 2 "task_list(1)"]
[Current task is 2 "task_list(1)"]
instead of
[Switching to task 2]
[Current task is 2]
The logic to produce the taskno optionally followed
by the task name has been factorized in the task_to_str function.
Task names are output between double quotes in the new messages,
similarly to what GDB does for thread names.
However, no quotes are put around task names in 'info tasks' Name column.
This was discussed with Tom, that preferred no quotes there, while I
was more in favour of visual consistency.
I discussed with a few more users, which led to (exactly) 50% preferring
quotes and 50% preferring no quotes :).
To arrive to the decision to remove the quotes, the following "killing args"
were used:
* To have quotes or to not have quotes, that is the question; yes
but not *THE* question :).
* If there is not a clear majority that prefers quotes, better to
not disturb the existing user basis for a (somewhat) irrelevant
aspect.
* The opinion of the reviewer has more weight.
So, compared to the previous version, this version remotes the quotes
in 'info tasks'.
It improves the alignement of 'info tasks' output.
With this patch, we get:
(gdb) info task
ID TID P-ID Pri State Name
* 1 555555759030 48 Runnable main_task
2 555555759e30 1 48 Selective Wait mit
(gdb)
instead of
(gdb) info task
ID TID P-ID Pri State Name
* 1 555555759030 48 Runnable main_task
2 555555759e30 1 48 Selective Wait mit
(gdb)
(e.g. the first one properly shows parent and priority under the
correct header).
This is version 4 of the 'task name' patch.
Compared to version 3, the changes are:
output task names between quotes but not in 'info tasks'
gdb/ChangeLog
2019-09-12 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* NEWS: Announce that Ada task names are now shown at more places,
and between quotes (except in info task output).
* gdb/ada-tasks.c (task_to_str): New function.
(display_current_task_id): Call task_to_str.
(task_command_1): Likewise.
(print_ada_task_info): In non-mi mode, Properly align headers and data
when task-id length is > 9 (9 is the default for a 32 bits CORE_ADDR).
gdb/doc/ChangeLog
2019-09-12 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.texinfo (Ada Tasks): Tell the task name is printed, update
examples.
gdb/testsuite/ChangeLog
2019-09-12 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.ada/rdv_wait.exp: Update to new task names.
* gdb.base/task_switch_in_core.exp: Likewise.
* gdb.base/info_sources_base.c: Likewise.
|
|
It's been a long-standing nuisance that gdb reported unaligned accesses
on Solaris/SPARC as SIGSEGV, contrary to the shells and truss which
correctly report SIGBUS instead.
I could trace this down to the fault handling code in procfs.c
(procfs_target::wait): when pr_why is set to PR_FAULTED, the current
code sets the signal based on the fault number. For one, the code gets
this wrong for FLTACCESS (the unaligned access case) where it uses
SIGSEGV. What's worse, it's completely unnecessary to make up the
signal number inside gdb. Instead, it should just take what procfs
reports to avoid mismatches, which is what this patch does. I've
completely removed the explicit handling of the various fault codes: for
one, the list has already been incomplete, lacking FLTCPCOVF which
existed since at least Solaris 8. Besides, there's no reason to error
out on unknown fault codes: either the fault causes a signal which can
then be reported from procfs, or it doesn't (as for FLTPAGE) and no
reporting is necessary.
Tested on sparcv9-sun-solaris2.11 and x86_64-pc-solaris2.11. Also
spot-checked manually for a couple of cases (unaligned access, division
by 0, NULL pointer dereference).
* procfs.c (procfs_target::wait) <PR_FAULTED>: Get signal from
prstatus.pr_lwp.pr_info instead of making it up.
|
|
This simplifies memory management. I've also changed some global variables
to std::string accordingly (which store the result of these functions),
but not all because some are used with add_setshow_optional_filename_cmd
which requires a char*.
gdb/ChangeLog:
2019-09-11 Christian Biesinger <cbiesinger@google.com>
* auto-load.c (auto_load_expand_dir_vars): Update.
* defs.h (gdb_datadir): Change to std::string.
(python_libdir): Likewise.
(relocate_gdb_directory): Change return type to std::string.
* guile/guile.c (gdbscm_data_directory): Update.
(initialize_scheme_side): Update.
* jit.c (jit_reader_dir): Change to std::string.
(jit_reader_load_command): Update.
* main.c (gdb_datadir): Change to std::string.
(python_libdir): Likewise.
(set_gdb_data_directory): Update.
(relocate_path): Change to return std::string.
(relocate_gdb_directory): Change to return std::string.
(relocate_gdbinit_path_maybe_in_datadir): Update.
(captured_main_1): Update.
* python/python.c (do_start_initialization): Update.
* top.c (show_gdb_datadir): Update.
* xml-syscall.c (xml_init_syscalls_info): Update.
(init_syscalls_info): Update.
|
|
This simplifies get_init_files and makes it possible to reuse
this code in an upcoming patch for SYSTEM_GDBINIT_DIR.
gdb/ChangeLog:
2019-09-11 Christian Biesinger <cbiesinger@google.com>
* main.c (relocate_gdbinit_path_maybe_in_datadir): Factor this code
out of get_init_files.
(get_init_files): Update.
|
|
To avoid manual memory management.
Tested on buildbot.
gdb/ChangeLog:
2019-09-11 Christian Biesinger <cbiesinger@google.com>
* main.c (get_init_files): Change to use std::string.
(captured_main_1): Update.
(print_gdb_help): Update.
|
|
The code used to have undefined behaviour when template parameter is float and
host_float is NaN, because it attempted to convert NaN value to LONGEST at the
last statement. This frequently caused crashes on tests that checked "info
all-registers" (at least when the code is compiled with clang; I didn't test
with gdb).
gdb/ChangeLog:
*target-float.c (host_float_ops<T>::to_longest): Update
implementation.
|
|
This parameter is really a boolean, so change the type accordingly
and update the callers.
This is for symbol_set_names, add_psymbol_to_bcache, and
add_psymbol_to_list.
minimal_symbol_reader::record_full was already passing a bool
to symbol_set_names.
gdb/ChangeLog:
2019-09-11 Christian Biesinger <cbiesinger@google.com>
* dbxread.c (read_dbx_symtab): Update.
* dwarf2read.c (load_partial_dies): Update.
* mdebugread.c (parse_partial_symbols): Update.
(handle_psymbol_enumerators): Update.
* psympriv.h (add_psymbol_to_list): Change type of copy_names to bool.
* psymtab.c (add_psymbol_to_bcache): Likewise.
(add_psymbol_to_list): Likewise.
* symtab.c (symbol_set_names): Likewise.
* symtab.h (symbol_set_names): Likewise.
* xcoffread.c (scan_xcoff_symtab): Update.
|
|
This introduces a new bfd_set_filename function, which is then used in
various spots in gdb. This allows for the removal of some casts.
bfd/ChangeLog
2019-09-11 Tom Tromey <tom@tromey.com>
* opncls.c (bfd_set_filename): New function.
* bfd-in2.h: Regenerate.
gdb/ChangeLog
2019-09-11 Tom Tromey <tom@tromey.com>
* symfile-mem.c (symbol_file_add_from_memory): Use
bfd_set_filename.
* solib-darwin.c (darwin_bfd_open): Use bfd_set_filename.
* solib-aix.c (solib_aix_bfd_open): Use bfd_set_filename.
|
|
This updates the "save gdb-index" documentation to reflect the new
state of Ada support. It also corrects an existing grammatical error.
gdb/doc/ChangeLog
2019-09-10 Tom Tromey <tromey@adacore.com>
* gdb.texinfo (Index Files): Update Ada text.
|
|
This adds Ada support to the cc-with-tweaks.exp board file, so that we
can test Ada this way. The cc-with-tweaks.sh script already works
reasonably well as a wrapper for gnatmake.
gdb/testsuite/ChangeLog
2019-09-10 Tom Tromey <tromey@adacore.com>
* boards/cc-with-tweaks.exp: Set GNATMAKE_FOR_TARGET.
|
|
This patch adds support for Ada to .debug_names. I opted to leave
.gdb_index alone, because in my view it is a defunct format.
gdb/ChangeLog
2019-09-10 Tom Tromey <tromey@adacore.com>
* dwarf-index-write.c (write_psymbols): Extend error message.
(debug_names::insert): Add Ada code.
(debug_names::write_psymbols): Remove Ada check.
(debug_names) <m_string_obstack>: New member.
* dwarf2read.c (gdb_index_symbol_name_matcher): Remove.
(gdb_index_symbol_name_matcher::matches): Remove.
(mapped_index_base::find_name_components_bounds): Add "lang"
parameter.
(mapped_index_base::build_name_components): Also split names
according to Ada syntax.
(dw2_expand_symtabs_matching_symbol): Loop over languages. Change
type of "match_callback".
(check_match, check_find_bounds_finds)
(dw2_expand_symtabs_matching): Update.
(dw2_debug_names_iterator): Add new constructor.
(dw2_debug_names_map_matching_symbols): New function.
(dw2_debug_names_expand_symtabs_matching): Update.
(dwarf2_debug_names_functions): Use
dw2_debug_names_map_matching_symbols.
|
|
An internal Ada test case showed that the .debug_names code does not
compute the same list of file names as the partial symbol reader. In
particular, the partial symbol reader uses the DW_AT_name of the CU:
/* Allocate a new partial symbol table structure. */
filename = dwarf2_string_attr (comp_unit_die, DW_AT_name, cu);
if (filename == NULL)
filename = "";
pst = create_partial_symtab (per_cu, filename);
This patch changes the .debug_names reader to follow.
gdb/ChangeLog
2019-09-10 Tom Tromey <tromey@adacore.com>
* dwarf2read.c (dw2_get_file_names_reader): Add the
CU's file name to the results.
gdb/testsuite/ChangeLog
2019-09-10 Tom Tromey <tromey@adacore.com>
* gdb.ada/dgopt.exp: New file.
* gdb.ada/dgopt/x.adb: New file.
|
|
This patch further simplifies the map_matching_symbols callback, by
having it take a lookup_name_info rather than a plain string.
gdb/ChangeLog
2019-09-10 Tom Tromey <tromey@adacore.com>
* ada-lang.c (add_nonlocal_symbols): Combine calls to
map_matching_symbols. Update.
* dwarf2read.c (dw2_map_matching_symbols): Update.
* psymtab.c (match_partial_symbol): Change type; update.
(psym_map_matching_symbols): Likewise.
* symfile-debug.c (debug_qf_map_matching_symbols): Change
type; update.
* symfile.h (struct quick_symbol_functions)
<map_matching_symbols>: Change "name" to be a lookup_name_info.
Remove "match".
|
|
This introduces a new helper function,
iterate_over_symbols_terminated, and changes psym_map_matching_symbols
to use it. A subsequent patch will introduce a new user of this
function in the DWARF reader.
gdb/ChangeLog
2019-09-10 Tom Tromey <tromey@adacore.com>
* psymtab.c (map_block): Remove.
(psym_map_matching_symbols): Use iterate_over_symbols_terminated.
* symtab.c (iterate_over_symbols_terminated): New function.
* symtab.c (iterate_over_symbols_terminated): Declare.
|
|
This changes iterate_over_symbols to return a bool. This allows it to
be reused in another context in a subsequent patch.
gdb/ChangeLog
2019-09-10 Tom Tromey <tromey@adacore.com>
* ada-lang.c (ada_iterate_over_symbols): Return bool.
* language.h (struct language_defn) <la_iterate_over_symbols>:
Return bool.
* symtab.c (iterate_over_symbols): Return bool.
* symtab.h (iterate_over_symbols): Return bool.
|
|
This changes map_matching_symbols to take a
symbol_found_callback_ftype, rather than separate callback and data
parameters. This enables a future patch to clean up some existing
code so that it can more readily be shared.
gdb/ChangeLog
2019-09-10 Tom Tromey <tromey@adacore.com>
* ada-lang.c (aux_add_nonlocal_symbols): Change type.
(add_nonlocal_symbols): Update.
* dwarf2read.c (dw2_map_matching_symbols): Change type.
* psymtab.c (map_block, psym_map_matching_symbols): Change type.
* symfile-debug.c (debug_qf_map_matching_symbols): Change type.
* symfile.h (struct quick_symbol_functions) <map_matching_symbols>:
Change type of "callback". Remove "data".
|
|
* DW_UT_skeleton and DW_UT_split_compile compilation units have dwo ids
to match the compilation unit in the skeleton and .dwo files. The dwo_id is
in the header.
Tested with CC=/usr/bin/gcc (version 8.3.0) against master branch (also with
-gsplit-dwarf and -gdwarf-4 flags) and there was no increase in the set of
tests that fails.
This is part of an effort to support DWARF 5 in gdb.
gdb/ChangeLog:
* dwarf2read.c (comp_unit_head): Update comment.
(dwarf2_dwo_name): New function declaration.
(dwarf_unit_type_name): New function declaration.
(read_comp_unit_head): Add support for new compilation units,
DW_UT_partial, DW_UT_skeleton, DW_UT_split_compile, DW_UT_split_type.
Particularly, DW_UT_skeleton and DW_UT_split_compile have dwo_id
(currently named as "signature") in their header. Also clarify error
messages.
(lookup_dwo_id): New function. Returns the dwo id of the given
compile unit.
(lookup_dwo_unit): Use the new lookup_dwo_id function.
(init_cutu_and_read_dies): Use the new dwarf2_dwo_name and lookup_dwo_id
functions.
(create_dwo_cu_reader): Use the added lookup_dwo_id function.
(dwarf2_dwo_name): Get the dwo name if present.
(dwarf_unit_type_name): Convert DW_UT_* types to string for diagnostic
purposes.
|
|
This changes the "info win" command to use ui-out. This yields
somewhat nicer table output.
gdb/ChangeLog
2019-09-09 Tom Tromey <tom@tromey.com>
* tui/tui-win.c (tui_all_windows_info): Use ui_out.
|
|
Valgrind reports the below leak.
Make the variable progname_copy static, so that Valgrind continues
to find a pointer to the memory given to Python.
Note that the comment in do_start_initialization and the Python documentation
indicates that the progname given to Py_SetProgramName cannot be freed.
However, in Python 3.7.4, Py_SetProgramName does:
void
Py_SetProgramName(const wchar_t *program_name)
{
...
PyMem_RawFree(_Py_path_config.program_name);
_Py_path_config.program_name = _PyMem_RawWcsdup(program_name);
So, it looks like 3.7.4 Python duplicates its argument, which explains
the leak found by Valgrind.
It looks better to respect the doc and not have GDB freeing the string
given to Py_SetProgramName, and avoid the leak error by declaring
the progname_copy static.
This will work with Python versions that really use this string without
duplicating it, and avoids a leak report for Python version that duplicates
it.
==4023== 200 bytes in 1 blocks are definitely lost in loss record 4,545 of 7,116^M
==4023== at 0x4C29F33: malloc (vg_replace_malloc.c:307)^M
==4023== by 0x446D27: xmalloc (alloc.c:60)^M
==4023== by 0x657C77: do_start_initialization (python.c:1610)^M
==4023== by 0x657C77: _initialize_python() (python.c:1823)^M
==4023== by 0x75FE24: initialize_all_files() (init.c:231)^M
==4023== by 0x708A94: gdb_init(char*) (top.c:2242)^M
==4023== by 0x5E7460: captured_main_1 (main.c:857)^M
==4023== by 0x5E7460: captured_main (main.c:1161)^M
==4023== by 0x5E7460: gdb_main(captured_main_args*) (main.c:1186)^M
==4023== by 0x4122D4: main (gdb.c:32)^M
gdb/ChangeLog
2019-09-09 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* python/python.c (do_start_initialization): Make progname_copy static,
to avoid a leak report.
|
|
If a TUI window has a long title, it can overflow the title line.
This changes the TUI to use just the tail part of the title in this
case.
gdb/ChangeLog
2019-09-08 Tom Tromey <tom@tromey.com>
* tui/tui-wingeneral.c (box_win): Truncate long window titles.
gdb/testsuite/ChangeLog
2019-09-08 Tom Tromey <tom@tromey.com>
* gdb.tui/resize.exp: Remove setup_xfail.
* gdb.tui/regs.exp: Remove setup_xfail.
* gdb.tui/basic.exp: Remove setup_xfail.
|
|
The only two values valid to pass to the block_index parameter of
quick_symbol_functions::lookup_symbol are GLOBAL_BLOCK and STATIC_BLOCK,
part of enum block_enum. Change the type of that parameter to
block_enum.
Change also the block_index field of dw2_symtab_iterator in the same
way.. This makes it consistent with dw2_debug_names_iterator, which
already uses block_enum for its block_index field.
This is a follow-up to this thread:
https://sourceware.org/ml/gdb-patches/2019-08/msg00097.html
gdb/ChangeLog:
* dwarf2read.c (struct dw2_symtab_iterator) <block_index>:
Change type to gdb::optional<block_enum>.
(dw2_symtab_iter_init): Change block_index parameter type
to gdb::optional<block_enum>.
(dw2_lookup_symbol): Change block_index parameter
type to block_enum.c
(dw2_debug_names_lookup_symbol): Likewise.
* psymtab.c (psym_lookup_symbol): Likewise.
* symfile-debug.c (debug_qf_lookup_symbol): Likewise.
* symfile.h (struct quick_symbol_functions) <lookup_symbol>:
Likewise.
|
|
gdb/testsuite/
* gdb.base/label.exp: un-XFAIL label related tests under Clang.
* gdb.cp/cplabel.exp: Ditto.
* gdb.linespec/ls-errs.exp: Ditto.
|
|
These parameters are only used as bools. This also
renames "flag" to "relocatable" to make it clearer
what it does.
gdb/ChangeLog:
2019-09-06 Christian Biesinger <cbiesinger@google.com>
* defs.h (relocate_gdb_directory): Change int to bool in
signature and rename flag to relocatable.
* main.c (relocate_path): Likewise.
(relocate_gdb_directory): Likewise.
|
|
This macro says:
/* Cast from const char * to char * so that caller can assign to
a char * without a warning. */
I reckon that isn't such a good idea since it can result in char*
variables where const char* is appropriate. Not very many places
need the char* cast.
bfd/
* aout-target.h (object_p): Formatting.
* bfd-in.h (bfd_get_filename): Don't cast to char*.
* corefile.c (generic_core_file_matches_executable_p): Constify
variables and remove cast.
* bfd-in2.h: Regenerate.
binutils/
* nm.c (print_object_filename_bsd, print_object_filename_sysv),
(print_object_filename_posix, print_archive_filename_bsd),
(print_archive_filename_sysv, print_archive_filename_posix),
(print_archive_member_bsd, print_archive_member_sysv),
(print_archive_member_posix): Constify parameter.
(struct output_fns <print_object_filename, print_archive_filename>),
(<print_archive_member>): Likewise.
* objcopy.c (copy_archive): Add cast for make_tempdir.
ld/
* emultempl/elf32.em (gld${EMULATION_NAME}_search_needed): Constify
variable.
* emultempl/pe.em (gld_${EMULATION_NAME}_after_open): Likewise.
* emultempl/pep.em (gld_${EMULATION_NAME}_after_open): Likewise.
gdb/
* coffread.c (coff_symfile_read): Constify filename variable.
* dbxread.c (dbx_symfile_init, coffstab_build_psymtabs),
(elfstab_build_psymtabs, stabsect_build_psymtabs): Likewise.
* gdb_bfd.c (gdb_bfd_close_or_warn): Likewise.
* solib.c (reload_shared_libraries_1): Likewise.
* symfile.c (reread_symbols): Likewise.
* solib-aix.c (solib_aix_bfd_open): Add cast for xfree of filename.
* solib-darwin.c (darwin_bfd_open): Likewise.
* symfile-mem.c (symbol_file_add_from_memory): Likewise.
sim/cris/
* sim-if.c (sim_open): Constify filename variable.
|
|
In gdb.base/ui-redirect.exp, the "save breakpoint" command is used to write
the current breakpoints to a file, but the actual output is not verified.
Consequently, the test has regressed in that the "print 1" command associated
with a breakpoint on main is removed by a subsequent runto_main, which first
deletes all breakpoints:
...
(gdb) break main
Breakpoint 1 at 0x4004d7: file start.c, line 34.
(gdb) commands
Type commands for breakpoint(s) 1, one per line.
End with a line saying just "end".
> PASS: gdb.base/ui-redirect.exp: commands
print 1
> PASS: gdb.base/ui-redirect.exp: print 1
end
(gdb) PASS: gdb.base/ui-redirect.exp: end
delete breakpoints
Delete all breakpoints? (y or n) y
...
and consequently the "save breakpoint" output is missing the breakpoint
command for main:
...
break main
- commands
- print 1
- end
break foo
break bar
...
Fix this by replacing "gdb_breakpoint main" with runto_main, and verifying the
"save breakpoints" output.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-09-05 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (cmp_file_string): New proc.
* gdb.base/ui-redirect.exp: Replace "gdb_breakpoint main" with
runto_main. Verify save breakpoints output.
|
|
Once the executable is started, info variables can show thousands
of variables belonging to glibc (see below).
This long list of variables then causes the test to fail, due
to expect's buffer overflow:
Running /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var.exp ...
ERROR: internal buffer is full.
ERROR: internal buffer is full.
ERROR: internal buffer is full.
Fix this by testing 'info variables' without running the executable.
gdb ./info-var
...
Reading symbols from ./info-var...
(gdb) |info variables|wc
27 54 971
(gdb) start
Temporary breakpoint 1 at 0x1129: file /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var-f1.c, line 23.
Starting program: /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/outputs/gdb.base/info-var/info-var
Temporary breakpoint 1, main ()
at /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var-f1.c:23
23 return global_var + get_offset() + f1_var;
(gdb) |info variables|wc
4334 14581 130738
(gdb)
gdb/testsuite/ChangeLog
2019-09-04 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/info-var.exp: Test info variables without running
to main, to avoid expect's buffer overflow.
|
|
Some domain_enum values were not handled in print_partial_symbols
which means that 'maintenance print psymbols' would print '<invalid
domain>' when it shouldn't have.
gdb/ChangeLog:
* psymtab.c (print_partial_symbols): Handle missing domain_enum
values MODULE_DOMAIN and COMMON_BLOCK_DOMAIN.
|
|
In Ada, the programmer can request that a range type with a non-zero
base be stored in the minimal number of bits required for the range.
This is done by biasing the values; so, for example, a range of -7..-4
may be stored as two bits with a bias of -7.
This patch implements this for gdb. It is done by adding a bias to
struct range_bounds and then adjusting a few spots to handle this.
The test case is written to use -fgnat-encodings=minimal, but a future
compiler patch will change the compiler to emit DW_AT_GNU_bias with
-fgnat-encodings=gdb. It seemed good to get the gdb patch in first.
Tested on x86-64 Fedora 29; plus a variety of targets using AdaCore's
internal test suite.
gdb/ChangeLog
2019-09-03 Tom Tromey <tromey@adacore.com>
* ada-valprint.c (ada_val_print_num): Don't recurse for range
types.
(has_negatives): Unbias a range type bound.
* dwarf2read.c (read_subrange_type): Handle DW_AT_GNU_bias.
* gdbtypes.c (operator==): Handle new field.
(create_range_type): Add "bias" parameter.
(create_static_range_type, resolve_dynamic_range): Update.
* gdbtypes.h (struct range_bounds) <bias>: New member.
(create_range_type): Add bias parameter.
* printcmd.c (print_scalar_formatted): Unbias range types.
* value.c (unpack_long): Unbias range types.
(pack_long): Bias range types.
gdb/testsuite/ChangeLog
2019-09-03 Tom Tromey <tromey@adacore.com>
* gdb.ada/bias.exp: New file.
* gdb.ada/bias/bias.adb: New file.
* gdb.ada/print_chars.exp: Add regression test.
* gdb.ada/print_chars/foo.adb (My_Character): New type.
(MC): New variable.
|