This moves dwarf2_per_cu_data::imported_symtabs earlier, near where
the other data members are located.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.h (struct dwarf2_per_cu_data) <imported_symtabs>:
Move earlier.
Change-Id: I314ddaa6f67c53a848e513b3f6d42913bd957833
This moves the line_header class to a pair of new files, making
dwarf2/read.c somewhat smaller.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.h (dwarf_line_debug): Declare.
* Makefile.in (COMMON_SFILES): Add dwarf2/line-header.c.
* dwarf2/read.c: Move line_header code to new files.
(dwarf_line_debug): No longer static.
* dwarf2/line-header.c: New file.
* dwarf2/line-header.h: New file.
Change-Id: I8d9d8a2398b4e888e20cc5dd68d041c28b5a06e3
This changes the two new line_table methods to return
unique_xmalloc_ptr. This removes a bit of manual memory management.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (struct line_header) <file_full_name,
file_file_name>: Return unique_xmalloc_ptr.
(line_header::file_file_name): Update.
(line_header::file_full_name): Update.
(dw2_get_file_names_reader): Update.
(macro_start_file): Update.
Change-Id: I9442dba43882fb26097d0770a291eea2b03913a4
This changes file_full_name and file_file_name methods to be methods
on line_header. This seems more clear to me.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (struct line_header) <file_full_name,
file_file_name>: Declare methods.
(dw2_get_file_names_reader): Update.
(file_file_name): Now a method.
(file_full_name): Likewise.
(macro_start_file): Update.
Change-Id: I50d3e91665a9637c732e1e8d8e4263764c766d9c
dwarf_always_disassemble is only used in dwarf2/loc.c, so move the
definition and the command infrastructure to that file.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (dwarf_always_disassemble)
(show_dwarf_always_disassemble): Move to loc.c.
(_initialize_dwarf2_read): Move "always-disassemble" registration
to loc.c.
* dwarf2/read.h (dwarf_always_disassemble): Don't declare.
* dwarf2/loc.c (dwarf_always_disassemble): Move from read.c. Now
static.
(show_dwarf_always_disassemble): Move from read.c.
(_initialize_dwarf2loc): Move always-disassemble from read.c.
Change-Id: I33fb88112e98e583c3f4919d20e4d100f2ea0124
This changes dwarf2_per_objfile::quick_file_names_table to be an
htab_up. This just removes a bit of manual management.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (~dwarf2_per_objfile): Update.
(create_quick_file_names_table): Return htab_up.
(dw2_get_file_names_reader, dw2_forget_cached_source_info):
Update.
* dwarf2/read.h (struct dwarf2_per_objfile)
<quick_file_names_table>: Now htab_up.
Change-Id: I4ff2fce8b8af27f4bfe01a11b97a889edfd23151
abbrev_table::read increments cur_abbrev->num_attrs in the inner loop,
but there's no need to do this, as the information is already stored
in the temporary vector.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/abbrev.c (abbrev_table::read): Simplify.
Change-Id: I765f12850ffa1c6066e884bb22c94468d1abdba4
This changes abbrev_table to use an htab_up rather than an ad hoc,
bucket-based hash table.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/abbrev.c (abbrev_table): Move constructor from header.
Rewrite.
(abbrev_table::add_abbrev, abbrev_table::lookup_abbrev): Rewrite.
* dwarf2/abbrev.h (struct abbrev_info) <next>: Remove.
(abbrev_table::abbrev_table): No longer inline.
(ABBREV_HASH_SIZE): Remove.
(abbrev_table::m_abbrevs): Now an htab_up.
Change-Id: Icbaa8e49501f9c43218d6a81a7e8c4d3a77d65dc
This cleans up the DWARF abbrev_table API a bit, primarily by making
various methods and members private.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (read_cutu_die_from_dwo): Update.
(cutu_reader): Update.
(build_type_psymtabs_1): Update.
* dwarf2/abbrev.c (abbrev_table::read): Rename.
(abbrev_table::alloc_abbrev): Update.
* dwarf2/abbrev.h (abbrev_table_up): Move earlier.
(abbrev_table::read): New static method, renamed from
abbrev_table_read_table.
(abbrev_table::alloc_abbrev)
(abbrev_table::add_abbrev): Now private.
(abbrev_table::abbrev_table): Now private.
(abbrev_table::m_abbrev_obstack): Now private. Rename.
Change-Id: I320dca83b799f672909ae66f73b7aca266adbaf9
This changes dwarf2_per_objfile::die_type_hash to be an htab_up,
moving its contents off the objfile obstack.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (set_die_type, get_die_type_at_offset): Update.
* dwarf2/read.h (struct dwarf2_per_objfile) <die_type_hash>: Now
htab_up.
Change-Id: Ic651f99ebf71bf7ad2dc2880192adacf7b60964a
This changes dwp_file to use htab_up for the loaded_cus and loaded_tus
members. This lets us avoid allocating the contents of these hash
tables on the objfile obstack.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (struct dwp_file) <loaded_cus, loaded_tus>: Now
htab_up.
(lookup_dwo_unit_in_dwp): Update.
(allocate_dwp_loaded_cutus_table): Return htab_up. Don't allocate
on obstack.
Change-Id: Id61209bf5c6c6faa0c067195af31fbcf26813a3a
This changes allocate_dwo_file_hash_table so that it does not use the
objfile obstack to store the contents of the hash table.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (allocate_dwo_file_hash_table): Don't allocate on
obstack.
Change-Id: Ic20a618acc7277e56aa18580c68f75c793bef97b
This changes dwarf2_per_objfile::line_header_hash to be an htab_up,
and changes it to use heap allocation.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (~dwarf2_per_objfile): Don't delete
line_header_hash.
(handle_DW_AT_stmt_list): Update. Don't allocate on obstack.
* dwarf2/read.h (struct dwarf2_per_objfile) <line_header_hash>:
Change type to htab_up.
Change-Id: Icb148a270838c0f96f38fc4a28b5b77d067927b6
This changes dwarf2_per_objfile::type_unit_groups to be an htab_up,
again allowing us to move the memory used by the hash table from the
objfile obstack to the heap.
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (allocate_type_unit_groups_table): Return
htab_up. Don't allocate on obstack.
(get_type_unit_group, dwarf2_build_psymtabs_hard): Update.
* dwarf2/read.h (struct dwarf2_per_objfile) <type_unit_groups>:
Change type to htab_up.
Change-Id: Ia045df0ff3ec30aac813da5a9a2314a607ef7ec8
This changes dwarf2_per_objfile::signatured_types to be an htab_up.
This in turn lets us change it not to use the objfile obstack for
allocation; obstack allocation for hash tables is a bad practice
because it leads to excess memory use if the table is ever resized.
gdb/ChangeLog
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.h (struct dwarf2_per_objfile) <signatured_types>:
Change type to htab_up.
* dwarf2/read.c (create_signatured_type_table_from_index)
(create_signatured_type_table_from_debug_names)
(create_all_type_units, add_type_unit)
(lookup_dwo_signatured_type, lookup_signatured_type)
(process_skeletonless_type_unit): Update.
(create_debug_type_hash_table, create_debug_types_hash_table):
Change type of types_htab.
(allocate_signatured_type_table, allocate_dwo_unit_table): Return
htab_up. Don't allocate on obstack.
(create_cus_hash_table): Change type of cus_htab parameter.
(struct dwo_file) <cus, tus>: Now htab_up.
(lookup_dwo_signatured_type, lookup_dwo_cutu)
(process_dwo_file_for_skeletonless_type_units, lookup_dwo_cutu)
(queue_and_load_all_dwo_tus): Update.
* dwarf2/index-write.c (write_gdbindex): Update.
(write_debug_names): Update.
Change-Id: I290a209b96945fb5f415c82723b62830e9c4b467
This removes some queue-related globals from the DWARF reader, in
favor of a new member on dwarf2_per_objfile. Globals must be avoided
in this code, because they prevent multi-threading the reader.
gdb/ChangeLog
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.h (struct dwarf2_queue_item): Move from
dwarf2/read.c. Remove "next" member. Add constructor ntad
destructor.
(struct dwarf2_per_objfile) <queue>: New member.
* dwarf2/read.c (struct dwarf2_queue_item): Move to
dwarf2/read.h.
(dwarf2_queue, dwarf2_queue_tail): Remove.
(class dwarf2_queue_guard): Add parameter to constructor. Use
DISABLE_COPY_AND_ASSIGN.
<m_per_objfile>: New member.
<~dwarf2_queue_guard>: Rewrite.
(dw2_do_instantiate_symtab, queue_comp_unit, process_queue):
Update.
(~dwarf2_queue_item): New.
Change-Id: Ied1f6ff3691352a66c4709b0b2cba0588f49f79a
Many functions take a "has_children" parameter (either as an in- or
out-parameter). However, it seems to me that it makes more sense to
have "has_children" be an attribute of a DIE. Making this change
allows this parameter to be eliminated in many places.
gdb/ChangeLog
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (struct die_info) <has_children>: New member.
(dw2_get_file_names_reader): Remove has_children.
(dw2_get_file_names): Update.
(read_cutu_die_from_dwo): Remove has_children.
(cutu_reader::init_tu_and_read_dwo_dies)
(cutu_reader::cutu_reader): Update.
(process_psymtab_comp_unit_reader, build_type_psymtabs_reader):
Remove has_children.
(build_type_psymtabs_1, process_skeletonless_type_unit)
(load_partial_comp_unit, load_full_comp_unit): Update.
(create_dwo_cu_reader): Remove has_children.
(create_cus_hash_table, read_die_and_children): Update.
(read_full_die_1,read_full_die): Remove has_children.
(read_signatured_type): Update.
(class cutu_reader) <has_children>: Remove.
Change-Id: I0d3d51ae9379554a66032648d51124bba07f87b4
die_reader_specs::comp_dir is assigned but never read; this patch
removes it.
gdb/ChangeLog
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2read.c (struct die_reader_specs) <comp_dir>: Remove.
(init_cu_die_reader, read_cutu_die_from_dwo): Update.
Change-Id: I9818a2593197a6972cddec23cd2f3dd0ce28f580
There's no need to forward-declare struct die_info in dwarf2read.h.
gdb/ChangeLog
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2read.h (struct die_info): Don't declare.
Change-Id: I0b8dbf99558b9547d418cfd8ef387a21f7dfa660
die_info_ptr is not used and so can be removed.
gdb/ChangeLog
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2read.h (die_info_ptr): Remove typedef.
Change-Id: Ibd0a5ad55876dc96a35b658adc36348f01e48884
This changes attr_form_is_block to be a method. This is done
separately because, unlike the other attribute functions,
attr_form_is_block had special handling for the case where the
argument was NULL. This required auditing each call site; in most
cases, NULL was already ruled out, but in a few spots, an additional
check was needed.
gdb/ChangeLog
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2read.c (read_call_site_scope)
(handle_data_member_location, dwarf2_add_member_fn)
(mark_common_block_symbol_computed, read_common_block)
(attr_to_dynamic_prop, partial_die_info::read)
(var_decode_location, dwarf2_fetch_die_loc_sect_off)
(dwarf2_symbol_mark_computed, set_die_type): Update.
* dwarf2/attribute.h (struct attribute) <form_is_block>: Declare
method.
(attr_form_is_block): Don't declare.
* dwarf2/attribute.c (attribute::form_is_block): Now a method.
Change-Id: Idfb290c61d738301ab991666f43e0b9cf577b2ae
This moves the attribute-related code out of dwarf2read.c and into the
new files dwarf2/attribute.[ch].
gdb/ChangeLog
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2read.c (struct attribute, DW_STRING)
(DW_STRING_IS_CANONICAL, DW_UNSND, DW_BLOCK, DW_SND, DW_ADDR)
(DW_SIGNATURE, struct dwarf_block, attr_value_as_address)
(attr_form_is_block, attr_form_is_section_offset)
(attr_form_is_constant, attr_form_is_ref): Move.
* dwarf2/attribute.h: New file.
* dwarf2/attribute.c: New file, from dwarf2read.c.
* Makefile.in (COMMON_SFILES): Add dwarf2/attribute.c.
Change-Id: I1ea4c146256a1b9e38b66f1c605d782a14eeded7
This moves the abbrev table code out of dwarf2read.c and into new
files dwarf2/abbrev.[ch].
gdb/ChangeLog
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2read.c (abbrev_table_up, struct abbrev_info)
(struct attr_abbrev, ABBREV_HASH_SIZE, struct abbrev_table):
Move.
(read_cutu_die_from_dwo, build_type_psymtabs_1): Update.
(abbrev_table::alloc_abbrev, abbrev_table::add_abbrev)
(abbrev_table::lookup_abbrev, abbrev_table_read_table): Move to
abbrev.c.
* dwarf2/abbrev.h: New file.
* dwarf2/abbrev.c: New file, from dwarf2read.c.
* Makefile.in (COMMON_SFILES): Add dwarf2/abbrev.c.
Change-Id: I87911bc5297de4407587ca849fef8e8d19136c30
This moves some section-handling code from dwarf2read.c into new
files, dwarf2/section.[ch].
gdb/ChangeLog
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2read.h (struct dwarf2_section_info, dwarf2_read_section):
Move to dwarf2/section.h.
* dwarf2read.c (get_containing_section, get_section_bfd_owner)
(get_section_bfd_section, get_section_name)
(get_section_file_name, get_section_id, get_section_flags)
(dwarf2_section_empty_p, dwarf2_read_section): Moe to
dwarf2/section.c.
* dwarf2/section.h: New file.
* dwarf2/section.c: New file, from dwarf2read.c.
* Makefile.in (COMMON_SFILES): Add dwarf2/section.c.
Change-Id: I9f8498094cf99d9521e9481622ce8adbd453daf4
This moves some scalar-unpacking code into a couple of new files,
dwarf2/leb.h and dwarf2/leb.c.
gdb/ChangeLog
2020-02-08 Tom Tromey <tom@tromey.com>
* dwarf2read.h (read_unsigned_leb128): Don't declare.
* dwarf2read.c (read_1_byte, read_1_signed_byte, read_2_bytes)
(read_2_signed_bytes, read_3_bytes, read_4_bytes)
(read_4_signed_bytes, read_8_bytes): Move to dwarf2/leb.h.
(read_unsigned_leb128, read_signed_leb128): Move to dwarf2/leb.c.
* dwarf2/leb.h: New file, from dwarf2read.c.
* dwarf2/leb.c: New file, from dwarf2read.c.
* dwarf2-frame.c (read_1_byte, read_4_bytes, read_8_bytes):
Remove.
* Makefile.in (CONFIG_SRC_SUBDIR): Add dwarf2.
(COMMON_SFILES): Add dwarf2/leb.c.
Change-Id: Idd19647686c8f959d226a95fdfca4db47c6e96d0
This patch redefines fputs_unfiltered in utils.c, with new behavior to
forward parameters to fputs_maybe_filtered. This makes
fputs_unfiltered identical to fputs_filtered, except filtering is
disabled.
Some callers of fputs_unfiltered have been updated to use ui_file_puts
where they were using other ui_file_* functions anyway for IO.
This fixes the problem I saw with \032\032post-prompt annotation being
flushed to stdout in the wrong order.
2020-02-05 Iain Buclaw <ibuclaw@gdcproject.org>
PR gdb/25190:
* gdb/remote-sim.c (gdb_os_write_stderr): Update.
* gdb/remote.c (remote_console_output): Update.
* gdb/ui-file.c (fputs_unfiltered): Rename to...
(ui_file_puts): ...this.
* gdb/ui-file.h (ui_file_puts): Add declaration.
* gdb/utils.c (emit_style_escape): Update.
(flush_wrap_buffer): Update.
(fputs_maybe_filtered): Update.
(fputs_unfiltered): Add function.
Change-Id: I17ed5078f71208344f2f8ab634a6518b1af6e213
Commit a0c1ffedc regressed certain cases coming from Eclipse.
See PR breakpoints/24915.
gdb/ChangeLog
2020-02-07 Tom Tromey <tromey@adacore.com>
PR breakpoints/24915:
* source.c (find_and_open_source): Do not check basenames_may_differ.
gdb/testsuite/ChangeLog
2020-02-07 Tom Tromey <tromey@adacore.com>
PR breakpoints/24915:
* gdb.base/annotate-symlink.exp: Use setup_xfail.
Change-Id: Iadbf42f35eb40c95ad32b2108ae25d8f199998bd
This patch moves gdbserver to the top level.
This patch is as close to a pure move as possible -- gdbserver still
builds its own variant of gnulib and gdbsupport. Changing this will
be done in a separate patch.
[v2] Note that, per Simon's review comment, this patch changes the
tree so that gdbserver is not built for or1k or score. This makes
sense, because there is apparently not actually a gdbserver port here.
[v3] This version of the patch also splits out some configury into a
new file, gdbserver/configure.host, so that the top-level configure
script can simply rely on it in order to decide whether gdbserver
should be built.
[v4] This version adds documentation and removes some unnecessary
top-level dependencies.
[v5] Update docs to mention "make all-gdbserver" and change how
top-level configure decides whether to build gdbserver, switching to a
single, shared script.
Tested by the buildbot.
ChangeLog
2020-02-07 Tom Tromey <tom@tromey.com>
Pedro Alves <palves@redhat.com>
* src-release.sh (GDB_SUPPORT_DIRS): Add gdbserver.
* gdbserver: New directory, moved from gdb/gdbserver.
* configure.ac (host_tools): Add gdbserver.
Only build gdbserver on certain systems.
* Makefile.in, configure: Rebuild.
* Makefile.def (host_modules, dependencies): Add gdbserver.
* MAINTAINERS: Add gdbserver.
gdb/ChangeLog
2020-02-07 Tom Tromey <tom@tromey.com>
* README: Update gdbserver documentation.
* gdbserver: Move to top level.
* configure.tgt (build_gdbserver): Remove.
* configure.ac: Remove --enable-gdbserver.
* configure: Rebuild.
* Makefile.in (distclean): Don't mention gdbserver.
Change-Id: I826b7565b54604711dc7a11edea0499cd51ff39e
The source_cache::ensure method may throw an exception through
the invocation of source_cache::get_plain_source_lines. This
happens when the source file is not found. The expected behaviour
of "ensure" is only returning "true" or "false" according to the
documentation in the header file.
So far, if gdb is in source layout and a file is missing, you see
some outputs like below:
,---------------------------------------------.
| test.c file is loaded in the source window. |
| |
| int main() |
| ... |
|---------------------------------------------|
| Remote debugging using :1234 |
| __start () at /path/to/crt0.S:141 |
| /path/to/crt0.S: No such file or directory. |
| (gdb) p/x $pc |
| $1 = 0x124 |
| (gdb) n |
| /path/to/crt0.S: No such file or directory. |
| (gdb) p/x $pc |
| $2 = 0x128 |
| (gdb) [pressing arrow-down key] |
| (gdb) terminate called after throwing an |
| instance of 'gdb_exception_error' |
`---------------------------------------------'
Other issues have been encountered as well [1].
The patch from Pedro [2] which is about preventing exceptions
from crossing the "readline" mitigates the situation by not
causing gdb crash, but still there are lots of errors printed:
,---------------------------------------------.
| test.c file is loaded in the source window. |
| |
| int main() |
| ... |
|---------------------------------------------|
| Remote debugging using :1234 |
| __start () at /path/to/crt0.S:141 |
| /path/to/crt0.S: No such file or directory. |
| (gdb) [pressing arrow-down key] |
| /path/to/crt0.S: No such file or directory. |
| (gdb) [pressing arrow-down key] |
| /path/to/crt0.S: No such file or directory. |
| (gdb) [pressing arrow-up key] |
| /path/to/crt0.S: No such file or directory. |
`---------------------------------------------'
With the changes of this patch, the behavior is like:
,---------------------------------------------.
| initially, source window is empty because |
| crt0.S is not found and according to the |
| program counter that is the piece of code |
| being executed. |
| |
| later, when we break at main (see commands |
| below), this window will be filled with the |
| the contents of test.c file. |
|---------------------------------------------|
| Remote debugging using :1234 |
| __start () at /path/to/crt0.S:141 |
| (gdb) p/x $pc |
| $1 = 0x124 |
| (gdb) n |
| (gdb) p/x $pc |
| $2 = 0x128 |
| (gdb) b main |
| Breakpoint 1 at 0x334: file test.c, line 8. |
| (gdb) cont |
| Continuing. |
| Breakpoint 1, main () at hello.c:8 |
| (gdb) n |
| (gdb) |
`---------------------------------------------'
There is no crash and the error message is completely
gone. Maybe it is good practice that the error is
shown inside the source window.
I tested this change against gdb.base/list-missing-source.exp
and there was no regression.
[1]
It has also been observed in the past that the register
values are not transferred from qemu's gdb stub, see:
https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/issues/226
[2]
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=2f267673f0fdee9287e6d404ecd4f2d29da0d2f2
gdb/ChangeLog:
* source-cache.c (source_cache::ensure): Surround
get_plain_source_lines with a try/catch.
(source_cache::get_line_charpos): Get rid of try/catch
and only check for the return value of "ensure".
* tui/tui-source.c (tui_source_window::set_contents):
Simplify "nlines" calculation.
gdb/testsuite/ChangeLog:
* gdb.tui/tui-missing-src.exp: Add the "missing source
file" test for the TUI.
Give a test a real name in order to avoid including a port number in
the results summary file - which makes comparing test results between
runs hard.
gdb/testsuiteChangeLog:
* gdb.server/multi-ui-errors.exp: Give a test a real name to avoid
including a port number in the output.
Change-Id: I19334e176ac15aee2a9732a6060c58153d9fb793
struct info_print_options is defined in both symtab.c and stack.c, which is
an ODR violation. So, I am renaming info_print_options and related
structs/functions in symtab.c:
info_print_options ==> info_vars_funcs_options
info_print_options_defs ==> info_vars_funcs_options_defs
make_info_print_options_def_group ==> make_info_vars_funcs_options_def_group
info_print_command_completer ==> info_vars_funcs_command_completer
gdb/ChangeLog:
* symtab.c (info_print_options): Rename to
info_vars_funcs_options.
(info_print_options_defs): Rename to
info_vars_funcs_options_defs.
(make_info_print_options_def_group): Rename to
make_info_vars_funcs_options_def_group.
(info_print_command_completer): Rename to
info_vars_funcs_command_completer.
(info_variables_command): Apply name changes.
(info_functions_command): Likewise.
(_initialize_symtab): Likewise.
This was a typo introduced in f6ac5f3d63.
Found by looking through NetBSD's GDB patches:
https://github.com/NetBSD/pkgsrc-wip/blob/master/gdb-netbsd/patches/patch-gdb_sparc-nat.h
This patch can't be tested on Linux because Linux does not use the
sparc_target template.
gdb/ChangeLog:
2020-02-05 Christian Biesinger <cbiesinger@google.com>
* sparc-nat.h (struct sparc_target) <xfer_partial>: Fix base class
function call.
Change-Id: I4fa88cbdc365efe89b84cc0619b60db38718d9ce
Makes the comment match the macro name in the #define/#ifdef.
gdb/ChangeLog:
2020-02-05 Christian Biesinger <cbiesinger@google.com>
* ppc-nbsd-tdep.h: Fix macro name in #endif comment.
Change-Id: If7b2e49e65495b8eb9ed7b6c9a11277579a93a05
In preparation for RISC-V/Linux `gdbserver' support factor out parts of
native target description determination code that can be shared between
the programs.
gdb/
* nat/riscv-linux-tdesc.h: New file.
* nat/riscv-linux-tdesc.c: New file, taking code from...
* riscv-linux-nat.c (riscv_linux_nat_target::read_description):
... here.
* configure.nat <linux> <riscv*>: Add nat/riscv-linux-tdesc.o to
NATDEPFILES.
In lib/fortran.exp, in the helper function fortran_int4, there is
currently no support for the LLVM Fortran compiler, Flang. As a
result we return the default pattern 'unknown' to match against all
4-byte integer types, which causes many tests to fail.
The same is true for all of the other helper functions related to
finding a suitable type pattern.
This commit adds support for Flang. There should be no change when
testing with gfortran.
gdb/testsuite/ChangeLog:
* lib/fortran.exp (fortran_int4): Handle clang.
(fortran_int8): Likewise.
(fortran_real4): Likewise.
(fortran_real8): Likewise.
(fortran_complex4): Likewise.
(fortran_logical4): Likewise.
(fortran_character1): Likewise.
Change-Id: Ife0d9828f78361fbd992bf21af746042b017dafc
We assign the simulator inferior a fake ptid. If this ptid is ever
set to null_ptid then we are going to run into problems - the
simulator ptid is what we return from gdbsim_target::wait, and this in
turn is used to look up the inferior data with a call to
find_inferior_pid, which asserts the pid is not 0 (which it is in
null_pid).
This commit adds an assert that the simulator's fake pid is not
null_ptid. There should be no user visible changes after this commit.
gdb/ChangeLog:
* remote-sim.c (sim_inferior_data::sim_inferior_data): Assert that
we don't set the fake simulator ptid to the null_ptid.
Change-Id: I6e08effe70e70855aea13c9caf4fd6913d5af56d
Add note to 'Race detection' entry in README about the possibility that
check-read1 makes failing tests pass.
gdb/testsuite/ChangeLog:
2020-02-04 Tom de Vries <tdevries@suse.de>
* README (Race detection): Add note.
Change-Id: I12ef2f0ec35abc5a0221585bf30e5f4f0616aa7c
The current inferior_exited_re regexp contains a '.*':
...
set inferior_exited_re "(?:\\\[Inferior \[0-9\]+ \\(.*\\) exited)"
...
This means that while matching a single line:
...
$ tclsh
% set re "(?:\\\[Inferior \[0-9\]+ \\(.*\\) exited)"
(?:\[Inferior [0-9]+ \(.*\) exited)
% set line "\[Inferior 1 (process 33) exited\]\n"
[Inferior 1 (process 33) exited]
% regexp $re $line
1
...
it also matches more than one line:
...
$ tclsh
% set re "(?:\\\[Inferior \[0-9\]+ \\(.*\\) exited)"
(?:\[Inferior [0-9]+ \(.*\) exited)
% set line "\[Inferior 1 (process 33) exited\]\n\[Inferior 2 (process 44) exited\]\n"
[Inferior 1 (process 33) exited]
[Inferior 2 (process 44) exited]
% regexp $re $line
1
...
Fix this by using "\[^\n\r\]*" instead of ".*".
Build and reg-tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-02-04 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (inferior_exited_re): Use "\[^\n\r\]*" instead of ".*".
Change-Id: Id7b1dcecd8c7fda3d1ab34b4fa1364d301748333
The inferior_exited_re regexp uses capturing parentheses by default:
...
set inferior_exited_re "(\\\[Inferior \[0-9\]+ \\(.*\\) exited)"
...
The parentheses are there to be able to use the expression as an atom, f.i.,
to have '+' apply to the whole regexp in "${inferior_exited_re}+".
But the capturing is not necessary, and it can be confusing because it's not
obvious in a regexp using "$inferior_exited_re (bla|bli)" that the first
captured expression is in $inferior_exited_re.
Replace by non-capturing parentheses. If we still want to capture the
expression, we can simply (and more clearly) use "($inferior_exited_re)".
Build and reg-tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-02-04 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (inferior_exited_re): Use non-capturing parentheses.
Change-Id: I7640c6129b1ada617424d6a63730d4b119c58ef3
This patch fixes test failures power8 and power9 caused by changes on
opcodes:
The dissasembler does not emit whitespace for instructions
anymore (c2b1c27545)
The dissasembler generates extended mnemonics for some instructions
instead (aae9718e4d)
The ldmx instruction was removed. This instruction was never
implemented (6fbc939cfd)
gdb/testsuite/ChangeLog:
2020-02-03 Rogerio A. Cardoso <rcardoso@linux.ibm.com>
* gdb.arch/powerpc-power8.exp: Delete trailing whitespace of
tbegin., tend. instructions. Replace bctar-, bctar+, bctarl-,
bctarl+ extended mnemonics when avaliable by bgttar, bnstarl,
blttar, bnetarl.
* gdb.arch/powerpc-power8.s: Fix comments. Fix instructions
binary for blttar, bnetarl.
* gdb.arch/powerpc-power9.exp: Delete trailing whitespace of
wait instruction. Delete ldmx test.
* gdb.arch/powerpc-power9.s: Delete ldmx instruction.
In the function f77_print_array_1, the variable 'i' which holds the
index is of datatype 'int', while bounds are of datatype LONGEST. Due to
size of int being smaller than LONGEST, the variable 'i' stores
incorrect values for high indexes (higher than max limit of int). Due
to this issue in sources, two abnormal behaviors are seen while printing
arrays with high indexes (please check array-bounds-high.f90) For high
indexes with negative sign, gdb prints empty array even if the array has
elements.
(gdb) p arr
$1 = ()
For high indexes with positive sign, gdb crashes. We have now changed
the datatype of 'i' to LONGEST which is same as datatype of bounds.
gdb/ChangeLog:
* f-valprint.c (f77_print_array_1): Changed datatype of index
variable to LONGEST from int to enable it to contain bound
values correctly.
gdb/testsuite/ChangeLog:
* gdb.fortran/array-bounds-high.exp: New file.
* gdb.fortran/array-bounds-high.f90: New file.
Change-Id: Ie2dce9380a249e634e2684b9c90f225e104369b7
Fix RISC-V native Linux support to handle a 64-bit FPU (FLEN == 64) with
both RV32 and RV64 systems, which is a part of the current Linux ABI for
hard-float systems, rather than assuming that (FLEN == XLEN) in target
description determination and that (FLEN == 64) in register access.
We can do better however and not rely on any particular value of FLEN
and probe for it dynamically, by observing that the PTRACE_GETREGSET
ptrace(2) call will only accept an exact regset size, and that will
reflect FLEN. Therefore iterate over the call in target description
determination with a geometrically increasing regset size until a match
is marked by a successful ptrace(2) call completion or we run beyond the
maximum size we can support.
Update register accessors accordingly, using FLEN determined to size the
buffer used for NT_PRSTATUS requests and then to exchange data with the
regcache.
Also handle a glibc bug where ELF_NFPREG is defined in terms of NFPREG,
however NFPREG is nowhere defined.
gdb/
* riscv-linux-nat.c [!NFPREG] (NFPREG): New macro.
(supply_fpregset_regnum, fill_fpregset): Handle regset buffer
offsets according to FLEN determined.
(riscv_linux_nat_target::read_description): Determine FLEN
dynamically.
(riscv_linux_nat_target::fetch_registers): Size regset buffer
according to FLEN determined.
(riscv_linux_nat_target::store_registers): Likewise.
Musl is giving warnings about these includes in this way:
warning: #warning redirecting incorrect #include <sys/errno.h> to <errno.h>
warning: #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h>
gdb/testsuite/Changelog:
* gdb.base/fileio.c: Remove #include of <sys/errno.h>.
Replace #include of <sys/fcntl.h> by <fcntl.h>.