binutils-gdb/gdb/ChangeLog

1125 lines
42 KiB
Plaintext
Raw Normal View History

2018-01-19 Tom Tromey <tom@tromey.com>
* rust-lang.c (rust_lookup_symbol_nonlocal): Look up qualified
symbols in the static and global blocks.
2018-01-19 James Clarke <jrtc27@jrtc27.com>
* nat/linux-ptrace.c: Remove unnecessary reinclusion of
gdb_ptrace.h, and move including gdb_wait.h ...
* nat/linux-ptrace.h: ... to here.
2018-01-19 Simon Marchi <simon.marchi@ericsson.com>
* inf-ptrace.c (inf_ptrace_detach): Adjust call to
inf_ptrace_detach_success.
(inf_ptrace_detach_success): Add inferior parameter, use it
instead of inferior_ptid, pass it to detach_inferior.
* inf-ptrace.h (inf_ptrace_detach_success): Add inferior
parameter.
* inferior.c (detach_inferior): Add overload that takes an
inferior object.
* inferior.h (detach_inferior): Likewise.
* linux-nat.c (linux_nat_detach): Use the inf parameter, don't
use inferior_ptid, adjust call to inf_ptrace_detach_success.
* linux-thread-db.c (thread_db_detach): Use inf parameter.
Pass inferior down to target_detach and to_detach The to_detach target_ops method implementations are currently expected to work on current_inferior/inferior_ptid. In order to make things more explicit, and remove some "shadow" parameter passing through globals, this patch adds an "inferior" parameter to to_detach. Implementations will be expected to use this instead of relying on the global. However, to keep things simple, this patch only does the minimum that is necessary to add the parameter. The following patch gives an example of how one such implementation would be adapted. If the approach is deemed good, we can then look into adapting more implementations. Until then, they'll continue to work as they do currently. gdb/ChangeLog: * target.h (struct target_ops) <to_detach>: Add inferior parameter. (target_detach): Likewise. * target.c (dispose_inferior): Pass inferior down. (target_detach): Pass inferior down. Assert that it is equal to the current inferior. * aix-thread.c (aix_thread_detach): Pass inferior down. * corefile.c (core_file_command): Pass current_inferior() down. * corelow.c (core_detach): Add inferior parameter. * darwin-nat.c (darwin_detach): Likewise. * gnu-nat.c (gnu_detach): Likewise. * inf-ptrace.c (inf_ptrace_detach): Likewise. * infcmd.c (detach_command): Pass current_inferior() down to target_detach. * infrun.c (follow_fork_inferior): Pass parent_inf to target_detach. (handle_vfork_child_exec_or_exit): Pass inf->vfork_parent to target_detach. * linux-nat.c (linux_nat_detach): Add inferior parameter. * linux-thread-db.c (thread_db_detach): Likewise. * nto-procfs.c (procfs_detach): Likewise. * procfs.c (procfs_detach): Likewise. * record.c (record_detach): Likewise. * record.h (struct inferior): Forward-declare. (record_detach): Add inferior parameter. * remote-sim.c (gdbsim_detach): Likewise. * remote.c (remote_detach_1): Likewise. (remote_detach): Likewise. (extended_remote_detach): Likewise. * sol-thread.c (sol_thread_detach): Likewise. * target-debug.h (target_debug_print_inferior_p): New macro. * target-delegates.c: Re-generate. * top.c (kill_or_detach): Pass inferior down to target_detach. * windows-nat.c (windows_detach): Add inferior parameter.
2018-01-19 17:47:57 +01:00
2018-01-19 Simon Marchi <simon.marchi@ericsson.com>
* target.h (struct target_ops) <to_detach>: Add inferior
parameter.
(target_detach): Likewise.
* target.c (dispose_inferior): Pass inferior down.
(target_detach): Pass inferior down. Assert that it is equal to
the current inferior.
* aix-thread.c (aix_thread_detach): Pass inferior down.
* corefile.c (core_file_command): Pass current_inferior() down.
* corelow.c (core_detach): Add inferior parameter.
* darwin-nat.c (darwin_detach): Likewise.
* gnu-nat.c (gnu_detach): Likewise.
* inf-ptrace.c (inf_ptrace_detach): Likewise.
* infcmd.c (detach_command): Pass current_inferior() down to
target_detach.
* infrun.c (follow_fork_inferior): Pass parent_inf to
target_detach.
(handle_vfork_child_exec_or_exit): Pass inf->vfork_parent to
target_detach.
* linux-nat.c (linux_nat_detach): Add inferior parameter.
* linux-thread-db.c (thread_db_detach): Likewise.
* nto-procfs.c (procfs_detach): Likewise.
* procfs.c (procfs_detach): Likewise.
* record.c (record_detach): Likewise.
* record.h (struct inferior): Forward-declare.
(record_detach): Add inferior parameter.
* remote-sim.c (gdbsim_detach): Likewise.
* remote.c (remote_detach_1): Likewise.
(remote_detach): Likewise.
(extended_remote_detach): Likewise.
* sol-thread.c (sol_thread_detach): Likewise.
* target-debug.h (target_debug_print_inferior_p): New macro.
* target-delegates.c: Re-generate.
* top.c (kill_or_detach): Pass inferior down to target_detach.
* windows-nat.c (windows_detach): Add inferior parameter.
Remove args from target detach I was looking into adding a parameter to target_detach, and was wondering what the args parameter was. It seems like in the distant past, it was possible to specify a signal number when detaching. That signal was injected in the process before it was detached. There is an example of code handling this in linux_nat_detach. With today's GDB, I can't get this to work. Doing "detach 15" (15 == SIGTERM) doesn't work, because detach is a prefix command and doesn't recognize the sub-command 15. Doing "detach inferiors 15" doesn't work because it expects a list of inferior id to detach. Therefore, I don't think there's a way of invoking detach_command with a non-NULL args. I also didn't find any documentation related to this feature. I assume that this feature stopped working when detach was made a prefix command, which is in f73adfeb8bae36885e6ea248d12223ab0d5eb9cb (sorry, there's no commit title) from 2006. Given that this feature was broken for such a long time and we haven't heard anything (AFAIK, I did not find any related bug), I think it's safe to remove it, as well as the args parameter to target_detach. If someone wants to re-introduce it, I would suggest rethinking the user interface, and in particular would suggest using signal name instead of numbers. I tried to fix all the impacted code, but I might have forgotten some spots. It shouldn't be hard to fix if that's the case. I also couldn't build-test everything I changed, especially the nto and solaris stuff. gdb/ChangeLog: * target.h (struct target_ops) <to_detach>: Remove args parameter. (target_detach): Likewise. * target.c (dispose_inferior): Adjust. (target_detach): Remove args parameter, adjust. * aix-thread.c (aix_thread_detach): Adjust. * corefile.c (core_file_command): Adjust. * corelow.c (core_detach): Adjust. * darwin-nat.c (darwin_detach): Adjust. * gnu-nat.c (gnu_detach): Adjust. * inf-ptrace.c (inf_ptrace_detach): Adjust. * infcmd.c (detach_command): Adjust * infrun.c (follow_fork_inferior): Adjust. (handle_vfork_child_exec_or_exit): Adjust. * linux-fork.c (linux_fork_detach): Remove args parameter. * linux-fork.h (linux_fork_detach): Likewise. * linux-nat.c (linux_nat_detach): Likewise, and adjust. * linux-thread-db.c (thread_db_detach): Likewise. * nto-procfs.c (procfs_detach): Likewise. * procfs.c (procfs_detach): Likewise. (do_detach): Remove signo parameter. * record.c (record_detach): Remove args parameter. * record.h (record_detach): Likewise. * remote-sim.c (gdbsim_detach): Likewise. * remote.c (remote_detach_1): Likewise. (remote_detach): Likewise. (extended_remote_detach): Likewise. * sol-thread.c (sol_thread_detach): Likewise. * target-delegates.c: Re-generate. * top.c (struct qt_args) <args>: Remove field. (kill_or_detach): Don't pass args. (quit_force): Don't set args. * windows-nat.c (windows_detach): Remove args parameter.
2018-01-19 17:47:24 +01:00
2018-01-19 Simon Marchi <simon.marchi@ericsson.com>
* target.h (struct target_ops) <to_detach>: Remove args
parameter.
(target_detach): Likewise.
* target.c (dispose_inferior): Adjust.
(target_detach): Remove args parameter, adjust.
* aix-thread.c (aix_thread_detach): Adjust.
* corefile.c (core_file_command): Adjust.
* corelow.c (core_detach): Adjust.
* darwin-nat.c (darwin_detach): Adjust.
* gnu-nat.c (gnu_detach): Adjust.
* inf-ptrace.c (inf_ptrace_detach): Adjust.
* infcmd.c (detach_command): Adjust
* infrun.c (follow_fork_inferior): Adjust.
(handle_vfork_child_exec_or_exit): Adjust.
* linux-fork.c (linux_fork_detach): Remove args parameter.
* linux-fork.h (linux_fork_detach): Likewise.
* linux-nat.c (linux_nat_detach): Likewise, and adjust.
* linux-thread-db.c (thread_db_detach): Likewise.
* nto-procfs.c (procfs_detach): Likewise.
* procfs.c (procfs_detach): Likewise.
(do_detach): Remove signo parameter.
* record.c (record_detach): Remove args parameter.
* record.h (record_detach): Likewise.
* remote-sim.c (gdbsim_detach): Likewise.
* remote.c (remote_detach_1): Likewise.
(remote_detach): Likewise.
(extended_remote_detach): Likewise.
* sol-thread.c (sol_thread_detach): Likewise.
* target-delegates.c: Re-generate.
* top.c (struct qt_args) <args>: Remove field.
(kill_or_detach): Don't pass args.
(quit_force): Don't set args.
* windows-nat.c (windows_detach): Remove args parameter.
2018-01-19 Yao Qi <yao.qi@linaro.org>
* arm-linux-tdep.c (arm_linux_gcc_target_options): New function.
(arm_linux_init_abi): Install it.
2018-01-19 Yao Qi <yao.qi@linaro.org>
* osabi.c (gdb_osabi_names): Extend the regexp for
arm-linux-gnueabihf.
2018-01-18 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (abbrev_table) <abbrevs>: Rename it to
m_abbrevs.
(abbrev_table::add_abbrev): Update.
(abbrev_table::lookup_abbrev): Update.
2018-01-18 Yao Qi <yao.qi@linaro.org>
* ppc-linux-tdep.c (ppu2spu_prev_register): Call cooked_read.
2018-01-17 Sergio Durigan Junior <sergiodj@redhat.com>
* compile/compile.c (compile_to_object): Convert "triplet_rx"
to "std::string".
2018-01-17 Tom Tromey <tom@tromey.com>
* dwarf2read.c (symbolp): Remove typedef. Don't instantiate VEC.
2018-01-17 Tom Tromey <tom@tromey.com>
* gdbtypes.h (add_dyn_prop): Remove objfile parameter.
* gdbtypes.c (add_dyn_prop): Remove objfile parameter.
(create_array_type_with_stride): Update.
* dwarf2read.c (set_die_type): Update.
2018-01-17 Tom Tromey <tom@tromey.com>
* dwarf2read.c (delayed_method_info): Remove typedef.
(dwarf2_cu::method_info): Now a std::vector.
(add_to_method_list): Update.
(free_delayed_list): Remove.
(compute_delayed_physnames): Update.
(process_full_comp_unit, process_full_type_unit): Clear the method
list. Remove cleanups.
(psymtab_include_file_name): Add name_holder parameter. Use
unique_xmalloc_ptr.
(dwarf_decode_lines): Update.
2018-01-17 Tom Tromey <tom@tromey.com>
Simon Marchi <simon.marchi@ericsson.com>
* dwarf2read.c (struct dwarf2_cu): Add constructor, destructor.
(dwarf2_per_objfile::free_cached_comp_units)
(init_tu_and_read_dwo_dies, init_cutu_and_read_dies)
(init_cutu_and_read_dies_no_follow): Update.
(dwarf2_cu::dwarf2_cu): Rename from init_one_comp_unit.
(dwarf2_cu::~dwarf2_cu): New.
(free_heap_comp_unit, free_stack_comp_unit): Remove.
(age_cached_comp_units, free_one_cached_comp_unit): Update.
2018-01-17 Tom Tromey <tom@tromey.com>
Simon Marchi <simon.marchi@ericsson.com>
* dwarf2read.c (struct dwarf2_cu) <abbrev_table>: Remove.
(struct die_reader_specs) <abbrev_table>: New member.
(struct abbrev_table): Add constructor.
<alloc_abbrev, add_abbrev, lookup_abbrev>: Declare.
<abbrev_obstack>: Now an auto_obstack.
(abbrev_table_up): New typedef.
(init_cu_die_reader): Add abbrev_table parameter.
(read_cutu_die_from_dwo): Remove abbrev_table_provided parameter.
Add result_dwo_abbrev_table.
(init_tu_and_read_dwo_dies, init_cutu_and_read_dies)
(init_cutu_and_read_dies_no_follow, build_type_psymtabs_1):
Update.
(peek_die_abbrev): Take die_reader_specs, not dwarf_cu as
parameter.
(skip_children): Update.
(abbrev_table::alloc_abbrev): Rename from
abbrev_table_alloc_abbrev.
(abbrev_table::add_abbrev): Rename from abbrev_table_add_abbrev.
(abbrev_table::lookup_abbrev): Rename from
abbrev_table_lookup_abbrev.
(abbrev_table_read_table): Return abbrev_table_up.
(abbrev_table_free, abbrev_table_free_cleanup)
(dwarf2_read_abbrevs, dwarf2_free_abbrev_table): Remove.
(load_partial_dies): Update.
2018-01-17 Tom Tromey <tom@tromey.com>
* dwarf2read.c (dwarf2_compute_name): Update comment.
(read_func_scope, read_variable): Update.
(new_symbol): Remove.
(new_symbol_full): Rename to new_symbol.
2018-01-17 18:59:51 +01:00
2018-01-17 Mike Gulick <mgulick@mathworks.com>
Fix gdb segv when objfile can't be opened This fixes PR 16577. This patch changes gdb_bfd_map_section to issue a warning rather than an error if it is unable to read the object file, and sets the size of the section/frame that it attempted to read to 0 on error. The description of gdb_bfd_map_section states that it will try to read or map the contents of the section SECT, and if successful, the section data is returned and *SIZE is set to the size of the section data. This function was throwing an error and leaving *SIZE as-is. Setting the section size to 0 indicates to dwarf2_build_frame_info that there is no data to read, otherwise it will try to read from an invalid frame pointer. Changing the error to a warning allows this to be handled gracefully. Additionally, the error was clobbering the breakpoint output indicating the current frame (function name, arguments, source file, and line number). E.g. Thread 3 "foo" hit Breakpoint 1, BFD: reopening /tmp/jna-1013829440/jna2973250704389291330.tmp: No such file or directory BFD: reopening /tmp/jna-1013829440/jna2973250704389291330.tmp: No such file or directory (gdb) While the "BFD: reopening ..." messages will still appear interspersed in the breakpoint output, the current frame info is now displayed: Thread 3 "foo" hit Breakpoint 1, BFD: reopening /tmp/jna-1013829440/jna1875755897659885075.tmp: No such file or directory BFD: reopening /tmp/jna-1013829440/jna1875755897659885075.tmp: No such file or directory warning: Can't read data for section '.eh_frame' in file '/tmp/jna-1013829440/jna1875755897659885075.tmp' do_something () at file.cpp:80 80 { (gdb)
2017-10-30 23:13:44 +01:00
PR gdb/16577
* gdb_bfd.c (gdb_bfd_map_section): If unable to read object file, issue
a warning instead of throwing an error, set section size to 0 and return
NULL.
* gdb_bfd.h (gdb_bfd_map_section): Update description.
2018-01-17 Simon Marchi <simon.marchi@ericsson.com>
* nat/linux-ptrace.h (linux_ptrace_attach_fail_reason): Return
std::string.
(linux_ptrace_attach_fail_reason_string): Likewise.
* nat/linux-ptrace.c (linux_ptrace_attach_fail_reason):
Likewise.
(linux_ptrace_attach_fail_reason_string): Likewise.
* linux-nat.c (attach_proc_task_lwp_callback): Adjust.
2018-01-17 Simon Marchi <simon.marchi@ericsson.com>
* linux-nat.c (linux_nat_attach): Remove xstrdup.
configure: Fix test for fs_base/gs_base in <sys/user.h> Make <sys/types.h> be included prior to including <sys/user.h>. glibc versions older than 2.14 use __uintNN_t types within certain structures defined in <sys/user.h> probably assuming these types are defined prior to including the header. This results in the following `configure` feature test compilation error that makes it think that `struct user_regs_struct` doesn't have `fs_base`/`gs_base` fields, althouh it does. configure:13617: checking for struct user_regs_struct.fs_base configure:13617: gcc -c -g -O2 -I/linux/include conftest.c >&5 In file included from conftest.c:158:0: /usr/include/sys/user.h:32:3: error: unknown type name '__uint16_t' __uint16_t cwd; ^ /usr/include/sys/user.h:33:3: error: unknown type name '__uint16_t' __uint16_t swd; ^ /usr/include/sys/user.h:34:3: error: unknown type name '__uint16_t' __uint16_t ftw; ^ /usr/include/sys/user.h:35:3: error: unknown type name '__uint16_t' __uint16_t fop; ^ /usr/include/sys/user.h:36:3: error: unknown type name '__uint64_t' __uint64_t rip; ^ /usr/include/sys/user.h:37:3: error: unknown type name '__uint64_t' __uint64_t rdp; ^ /usr/include/sys/user.h:38:3: error: unknown type name '__uint32_t' __uint32_t mxcsr; ^ /usr/include/sys/user.h:39:3: error: unknown type name '__uint32_t' __uint32_t mxcr_mask; ^ /usr/include/sys/user.h:40:3: error: unknown type name '__uint32_t' __uint32_t st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ ^ /usr/include/sys/user.h:41:3: error: unknown type name '__uint32_t' __uint32_t xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */ ^ /usr/include/sys/user.h:42:3: error: unknown type name '__uint32_t' __uint32_t padding[24]; ^ configure:13617: $? = 1 configure: failed program was: | /* confdefs.h */ ... | /* end confdefs.h. */ | #include <sys/user.h> | | int | main () | { | static struct user_regs_struct ac_aggr; | if (ac_aggr.fs_base) | return 0; | ; | return 0; | } Recent glibc versions don't use typedef'ed int types in <sys/user.h>, thus allowing it to be included as is (glibc commit d79a9c949c84e7f0ba33e87447c47af833e9f11a). However there're still some distros alive that use older glibc, for instance, RHEL/CentOS 6 package glibc 2.12. Also affects PR gdb/21559: ../../gdb/regcache.c:1087: internal-error: void regcache_raw_supply(regcache, int, const void): Assertion `regnum >= 0 && regnum < regcache->descr->nr_raw_registers' failed. As noted by Andrew Paprocki, who submitted the PR (https://sourceware.org/bugzilla/show_bug.cgi?id=21559#c3): > It should be noted that modifying `configure` to force on > `HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE` and > `HAVE_STRUCT_USER_REGS_STRUCT_GS_BASE` fixes this issue. For some > reason the `configure` tests for `fs_base` and `gs_base` fail > even though `sys/user.h` on RHEL5 has the fields defined in > `user_regs_struct`. Note that this patch does NOT fix the root cause of PR gdb/21559, although now that `configure` properly detects the presence of the fields and sets HAVE_XXX accordingly, the execution takes another path, which doesn't lead to the assertion failure in question. gdb/ChangeLog: 2018-01-17 Eldar Abusalimov <eldar.abusalimov@jetbrains.com> PR gdb/21559 * configure.ac: Include <sys/types.h> prior to <sys/user.h> when checking for fs_base/gs_base fields in struct user_regs_struct. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2018-01-17 Eldar Abusalimov <eldar.abusalimov@jetbrains.com> PR gdb/21559 * configure.ac: Include <sys/types.h> prior to <sys/user.h> when checking for fs_base/gs_base fields in struct user_regs_struct. * configure: Regenerate.
2018-01-15 14:57:42 +01:00
2018-01-17 Eldar Abusalimov <eldar.abusalimov@jetbrains.com>
PR gdb/21559
* configure.ac: Include <sys/types.h> prior to <sys/user.h> when
checking for fs_base/gs_base fields in struct user_regs_struct.
* configure: Regenerate.
2018-01-17 Yao Qi <yao.qi@linaro.org>
* aarch64-linux-tdep.c (aarch64_linux_gcc_target_options): New
function.
(aarch64_linux_init_abi): Install it to gdbarch hook
gcc_target_options.
2018-01-15 Pedro Alves <palves@redhat.com>
* common/signals-state-save-restore.c
(save_original_signals_state): Fix typos.
2017-01-12 Tom Tromey <tom@tromey.com>
Sergio Durigan Junior <sergiodj@redhat.com>
* Makefile.in (install-only): Install gdb-add-index.
2018-01-12 John Baldwin <jhb@FreeBSD.org>
* fbsd-tdep.c (KVE_PROTECTION): Correct value.
Fix GDB hang with remote after error from resume Since this commit -- Fix PR18360 - internal error when using "interrupt -a" (https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=c65d6b55) -- the testsuite shows long delays on s390 with native-gdbserver when executing certain tests, such as watchpoints.exp. These hangs have been discussed before in the context of buildbot problems, see here: https://sourceware.org/ml/gdb-patches/2017-12/msg00413.html The problem can easily be triggered by stopping on a breakpoint, then setting impossible watchpoints, and finally doing "continue". Then, after having set the step-over state (in keep_going_pass_signal in infrun.c), GDB tries to insert breakpoints and watchpoints into the inferior. This fails, and the "continue" command is aborted. But the step-over state is not cleared in this case, which causes future step-over attempts to be skipped since GDB thinks that "we already have an in-line step-over operation ongoing" (see start_step_over in infrun.c). Thus the next "continue" just goes on to wait for events from the remote, which will never occur. The problem can also be reproduced on amd64 with native-gdbserver, using the following change to watchpoints.exp: -- >8 -- --- a/gdb/testsuite/gdb.base/watchpoints.exp +++ b/gdb/testsuite/gdb.base/watchpoints.exp @@ -61,2 +61,3 @@ with_test_prefix "before inferior start" { gdb_test "watch ival3" ".*" "" + gdb_test "watch *(char \[256\] *) main" -- >8 -- To fix the hang, this patch clears the step-over info when insert_breakpoints has failed. Of course, with native-gdbserver the watchpoints.exp test case still causes many FAILs on s390, because gdbserver does not support watchpoints for that target. This is a separate issue. gdb/ChangeLog: 2018-01-12 Andreas Arnez <arnez@linux.vnet.ibm.com> * infrun.c (keep_going_pass_signal): Clear step-over info when insert_breakpoints fails.
2018-01-12 19:52:39 +01:00
2018-01-12 Andreas Arnez <arnez@linux.vnet.ibm.com>
* infrun.c (keep_going_pass_signal): Clear step-over info when
insert_breakpoints fails.
gdb.base/breakpoint-in-ro-region.exp regression on sss targets (PR gdb/22583) As Maciej reported at <https://sourceware.org/ml/gdb-patches/2017-12/msg00212.html>, this commit: commit d930703d68ae160ddfe8ebe5fdcf416fb6090e1e Date: Thu Nov 16 18:44:43 2017 +0000 Subject: Don't ever Quit out of resume caused regressions on software single-set targets, specifically: FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw off: single-step breakpoint is not left behind FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw on: single-step breakpoint is not left behind FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted on: auto-hw off: step in ro region (cannot insert hw break) FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted on: auto-hw off: single-step breakpoint is not left behind FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted on: auto-hw on: single-step breakpoint is not left behind and indeed detailed logs indicate a breakpoint is left lingering, e.g.: (gdb) PASS: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw off: step in ro region (cannot insert sw break) maint info breakpoints 0 Num Type Disp Enb Address What 0 sw single-step keep y 0x00400774 in main at [...]/gdb/testsuite/gdb.base/breakpoint-in-ro-region.c:24 inf 1 thread 1 stop only in thread 1 (gdb) FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw off: single-step breakpoint is not left behind vs: (gdb) PASS: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw off: step in ro region (cannot insert sw break) maint info breakpoints 0 No breakpoint or watchpoint matching '0'. (gdb) PASS: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw off: single-step breakpoint is not left behind as at commit d930703d68ae^. Before commit d930703d68ae, we had a cleanup installed in 'resume' that would delete single-step breakpoints on error: /* Resuming. */ /* Things to clean up if we QUIT out of resume (). */ static void resume_cleanups (void *ignore) { if (!ptid_equal (inferior_ptid, null_ptid)) delete_single_step_breakpoints (inferior_thread ()); normal_stop (); } That whole function was removed by d930703d68ae mainly to eliminate the normal_stop call: ~~~~ Note that the exception called from within resume ends up calling normal_stop via resume_cleanups. That's very borked though, because normal_stop is going to re-handle whatever was the last reported event, possibly even re-running a hook stop... ~~~~ But as the regression shows, removing resume_cleanups completely went a bit too far, as the delete_single_step_breakpoints call is still necessary. So fix the regression by reinstating the delete_single_step_breakpoints call on error. However, since we're trying to eliminate cleanups, restore it in a different form (using TRY/CATCH). Tested on x86-64 GNU/Linux both top of master and on top of a series that implements software single-step on x86. gdb/ChangeLog: 2018-01-11 Pedro Alves <palves@redhat.com> PR gdb/22583 * infrun.c (resume): Rename to ... (resume_1): ... this. (resume): Reimplement as wrapper around resume_1.
2018-01-11 18:50:31 +01:00
2018-01-11 Pedro Alves <palves@redhat.com>
PR gdb/22583
* infrun.c (resume): Rename to ...
(resume_1): ... this.
(resume): Reimplement as wrapper around resume_1.
Fix backwards compatibility with old GDBservers (PR remote/22597) At <https://sourceware.org/ml/gdb-patches/2017-12/msg00285.html>, Maciej reported that commit: commit 5cd63fda035d4ba949e6478406162c4673b3c9ef Date: Wed Oct 4 18:21:10 2017 +0100 Subject: Fix "Remote 'g' packet reply is too long" problems with multiple inferiors made GDB stop working with older stubs. Any attempt to continue execution after the initial connection fails with: [...] Process .../gdb/testsuite/outputs/gdb.base/advance/advance created; pid = 2670 Listening on port 2346 target remote [...]:2346 Remote debugging using [...]:2346 Reading symbols from .../lib64/ld.so.1...done. [Switching to Thread <main>] (gdb) continue Cannot execute this command without a live selected thread. (gdb) The problem is: (gdb) c Cannot execute this command without a live selected thread. (gdb) info threads Id Target Id Frame 1 Thread 14917 0x00007f341cd98ed0 in _start () from /lib64/ld-linux-x86-64.so.2 The current thread <Thread ID 2> has terminated. See `help thread'. ^^^^^^^^^^^ (gdb) Note, thread _2_. There's really only one thread in the inferior (it's still at the entry point), but still GDB added a bogus second thread. The reason GDB started adding a second thread after 5cd63fda035d is this hunk: + if (event->ptid == null_ptid) + { + const char *thr = strstr (p1 + 1, ";thread:"); + if (thr != NULL) + event->ptid = read_ptid (thr + strlen (";thread:"), + NULL); + else + event->ptid = magic_null_ptid; + } Note the else branch that falls back to magic_null_ptid. We reach that when we process the initial stop reply sent back in response to the the "?" (status) packet early in the connection setup: Sending packet: $?#3f...Ack Packet received: T0506:0000000000000000;07:40a510f4fd7f0000;10:d0fe1201577f0000; And note that that response does not include a ";thread:XXX" part. This stop reply is processed after listing threads with qfThreadInfo / qsThreadInfo : Sending packet: $qfThreadInfo#bb...Ack Packet received: m3915 Sending packet: $qsThreadInfo#c8...Ack Packet received: l meaning, when we process that stop reply, we treat the event as coming from a thread with ptid == magic_null_ptid, which is not yet in the thread list, so we add it then: (top-gdb) p ptid $1 = {m_pid = 42000, m_lwp = -1, m_tid = 1} (top-gdb) bt #0 0x0000000000840a8c in add_thread_silent(ptid_t) (ptid=...) at src/gdb/thread.c:269 #1 0x00000000007ad61d in remote_add_thread(ptid_t, int, int) (ptid=..., running=0, executing=0) at src/gdb/remote.c:1838 #2 0x00000000007ad8de in remote_notice_new_inferior(ptid_t, int) (currthread=..., executing=0) at src/gdb/remote.c:1921 #3 0x00000000007b758b in process_stop_reply(stop_reply*, target_waitstatus*) (stop_reply=0x1158860, status=0x7fffffffcc00) at src/gdb/remote.c:7217 #4 0x00000000007b7a38 in remote_wait_as(ptid_t, target_waitstatus*, int) (ptid=..., status=0x7fffffffcc00, options=0) at src/gdb/remote.c:7380 #5 0x00000000007b7cd1 in remote_wait(target_ops*, ptid_t, target_waitstatus*, int) (ops=0x102fac0 <remote_ops>, ptid=..., status=0x7fffffffcc00, options=0) at src/gdb/remote.c:7446 #6 0x000000000081587b in delegate_wait(target_ops*, ptid_t, target_waitstatus*, int) (self=0x102fac0 <remote_ops>, arg1=..., arg2=0x7fffffffcc00, arg3=0) at src/gdb/target-delegates.c:138 #7 0x0000000000827d77 in target_wait(ptid_t, target_waitstatus*, int) (ptid=..., status=0x7fffffffcc00, options=0) at src/gdb/target.c:2179 #8 0x0000000000715fda in do_target_wait(ptid_t, target_waitstatus*, int) (ptid=..., status=0x7fffffffcc00, options=0) at src/gdb/infrun.c:3589 #9 0x0000000000716351 in wait_for_inferior() () at src/gdb/infrun.c:3707 #10 0x0000000000715435 in start_remote(int) (from_tty=1) at src/gdb/infrun.c:3212 things go downhill from this. We don't see the problem with current master gdbserver, because that version always sends the ";thread:" part in the initial stop reply: Sending packet: $?#3f...Packet received: T0506:0000000000000000;07:a0d4ffffff7f0000;10:d05eddf7ff7f0000;thread:p3cea.3cea;core:3; Years ago I had added a "--disable-packet=" command line option to gdbserver which comes in handy for testing this, since the existing "--disable-packet=Tthread" precisely makes gdbserver not send that ";thread:" part in stop replies. The testcase added by this commit emulates old gdbserver making use of that. I've compared a testrun at 5cd63fda035d^ (before regression) with 'current master+patch', against old gdbserver at f8b73d13b7ca^. I hacked out --once, and "monitor exit" to be able to test. The results are a bit too unstable to tell accurately, but it looked like there were no regressions. Maciej confirmed this worked for him as well. No regressions on master (against master gdbserver). gdb/ChangeLog: 2018-01-11 Pedro Alves <palves@redhat.com> PR remote/22597 * remote.c (remote_parse_stop_reply): Default to the last-set general thread instead of to 'magic_null_ptid'. gdb/testsuite/ChangeLog: 2018-01-11 Pedro Alves <palves@redhat.com> PR remote/22597 * gdb.server/stop-reply-no-thread.c: New file. * gdb.server/stop-reply-no-thread.exp: New file.
2018-01-11 01:23:04 +01:00
2018-01-11 Pedro Alves <palves@redhat.com>
PR remote/22597
* remote.c (remote_parse_stop_reply): Default to the last-set
general thread instead of to 'magic_null_ptid'.
2018-01-10 Pedro Alves <palves@redhat.com>
* language.h (language_get_symbol_name_matcher): Rename ...
(get_symbol_name_matcher): ... this.
* language.c (language_get_symbol_name_matcher): Ditto.
* dictionary.c, linespec.c, minsyms.c, psymtab.c, symtab.c: All
callers adjusted.
Ada: make verbatim matcher override other language matchers (PR gdb/22670) A previous patch fixed verbatim matching in the lookup at the minimal symbol level, but we should also be finding that same symbol through the partial/full symtab search. For example, this is what happens if we use "print" instead of "break": (gdb) p <MixedCaseFunc> $1 = {<text variable, no debug info>} 0x4024dc <MixedCaseFunc> Before the C++ wildmatching series, GDB knows that MixedCaseFunc is a function without parameters, and the expression above means calling it. If you try it before having started the inferior, you'd get the following (expected) error: (gdb) print <MixedCaseFunc> You can't do that without a process to debug. The main idea behind making the name matcher be determined by the symbol's language is so that C++ (etc.) wildmatching in linespecs works even if the current language is not C++, as e.g., when you step through C or assembly code. Ada's verbatim matching syntax however ("<...>") isn't quite the same. It is more a property of the current language than of a particular symbol's language. We want to support this syntax when debugging an Ada program, but it's reason of existence is to find non-Ada symbols. This suggests going back to enabling it depending on current language instead of language of the symbol being matched. I'm not entirely happy with the "current_language" reference (though I think that it's harmless). I think we could try storing the current language in the lookup_name_info object, and then convert a bunch of functions more to pass around lookup_name_info objects instead of "const char *" names. I.e., build the lookup_name_info higher up. I'm not sure about that, I'll have to think more about it. Maybe something different will be better. Meanwhile, this gets us going. I've extended the testcase to also exercise a no-debug-info function, for extra coverage of the minsyms-only paths. gdb/ChangeLog: 2018-01-10 Pedro Alves <palves@redhat.com> PR gdb/22670 * dwarf2read.c (gdb_index_symbol_name_matcher::gdb_index_symbol_name_matcher): Adjust to use language_get_symbol_name_matcher instead of language_defn::la_get_symbol_name_matcher. * language.c (language_get_symbol_name_matcher): If in Ada mode and the lookup name is a verbatim match, return Ada's matcher. * language.h (language_get_symbol_name_matcher): Adjust comment. (ada_lookup_name_info::verbatim_p):: New method. gdb/testsuite/ChangeLog: 2018-01-10 Pedro Alves <palves@redhat.com> PR gdb/22670 * gdb.ada/bp_c_mixed_case.exp: Add intro comment. Test printing C functions too. Test setting breakpoints and printing C functions with no debug info too. * gdb.ada/bp_c_mixed_case/qux.c: New file.
2018-01-10 21:38:07 +01:00
2018-01-10 Pedro Alves <palves@redhat.com>
PR gdb/22670
* dwarf2read.c
(gdb_index_symbol_name_matcher::gdb_index_symbol_name_matcher):
Adjust to use language_get_symbol_name_matcher instead of
language_defn::la_get_symbol_name_matcher.
* language.c (language_get_symbol_name_matcher): If in Ada mode
and the lookup name is a verbatim match, return Ada's matcher.
* language.h (language_get_symbol_name_matcher): Adjust comment.
(ada_lookup_name_info::verbatim_p):: New method.
Fix gdb.ada/complete.exp's "complete break ada" test (PR gdb/22670) This patch fixes the regression covered by the test added by: commit 344420da6beac1e0b2f7964e7101f8dcdb509b0d Date: Thu Jan 4 03:30:37 2018 -0500 Subject: Add "complete break ada" test to gdb.ada/complete.exp The regression had been introduced by: commit b5ec771e60c1a0863e51eb491c85c674097e9e13 Date: Wed Nov 8 14:22:32 2017 +0000 Subject: Introduce lookup_name_info and generalize Ada's FULL/WILD name matching The gist of it is that linespec completion in Ada mode is generating additional matches that should not appear in the match list (internally generated symbols, or symbols that should be enclosed between "<...>"). These extraneous entries have uppercase characters, such as: break ada__stringsS break ada__strings__R11s [etc] These matches come from minimal symbols. The problem is that Ada minsyms end up with no language set (language_auto), and thus we end up using the generic symbol name matcher for those instead of Ada's. We already had a special case for in compare_symbol_name to handle this, but it was limited to expressions, while the case at hand is completing a linespec. Fix this by applying the special case to linespec completion as well. I.e., remove the EXPRESSION check from compare_symbol_name. That alone turns out to not be sufficient still -- GDB would still show a couple entries that shouldn't be there: ~~ break ada__exceptions__exception_data__append_info_exception_name__2Xn break ada__exceptions__exception_data__exception_name_length__2Xn ~~ The reason is that these minimal symbols end up with their language set to language_cplus / C++, because those encoded names manage to demangle successfully as C++ symbols (using an old C++ mangling scheme): $ echo ada__exceptions__exception_data__append_info_exception_name__2Xn | c++filt Xn::ada__exceptions__exception_data__append_info_exception_name(void) It's unfortunate that Ada's encoding scheme doesn't start with some unique prefix like "_Z" in the C++ Itanium ABI mangling scheme. For now, paper over that by treating C++ minsyms as Ada minsyms. gdb/ChangeLog: 2018-01-10 Pedro Alves <palves@redhat.com> PR gdb/22670 * ada-lang.c (ada_collect_symbol_completion_matches): If the minsym's language is language_auto or language_cplus, pass down language_ada instead. * symtab.c (compare_symbol_name): Don't frob symbol language here. gdb/testsuite/ChangeLog: 2018-01-10 Pedro Alves <palves@redhat.com> PR gdb/22670 * gdb.ada/complete.exp ("complete break ada"): Replace kfail with a fail.
2018-01-10 21:38:07 +01:00
2018-01-10 Pedro Alves <palves@redhat.com>
PR gdb/22670
* ada-lang.c (ada_collect_symbol_completion_matches): If the
minsym's language is language_auto or language_cplus, pass down
language_ada instead.
* symtab.c (compare_symbol_name): Don't frob symbol language here.
2018-01-10 Pedro Alves <palves@redhat.com>
PR gdb/22670
* minsyms.c (linkage_name_str): New function.
(iterate_over_minimal_symbols): Use it.
2018-01-09 John Baldwin <jhb@FreeBSD.org>
* NEWS: Document that 'info proc' now works on FreeBSD.
2018-01-09 John Baldwin <jhb@FreeBSD.org>
* configure.ac: Check for kinfo_getfile in libutil.
* configure: Regenerate.
* config.in: Regenerate.
* fbsd-nat.c: Include "fbsd-tdep.h".
(fbsd_fetch_cmdline): New.
(fbsd_fetch_kinfo_proc): Move earlier and change to return a bool
rather than calling error.
(fbsd_info_proc): New.
(fbsd_thread_name): Report error if fbsd_fetch_kinfo_proc fails.
(fbsd_wait): Report warning if fbsd_fetch_kinfo_proc fails.
(fbsd_nat_add_target): Set "to_info_proc" to "fbsd_info_proc".
2018-01-09 John Baldwin <jhb@FreeBSD.org>
* fbsd-nat.c (struct free_deleter): Remove.
(fbsd_find_memory_regions): Use gdb::unique_xmalloc_ptr<>.
2018-01-09 John Baldwin <jhb@FreeBSD.org>
* fbsd-nat.c (fbsd_pid_to_exec_file) [KERN_PROC_PATHNAME]: Return
NULL for an empty pathname.
2018-01-09 John Baldwin <jhb@FreeBSD.org>
* fbsd-tdep.c (KVE_STRUCTSIZE, KVE_START, KVE_END, KVE_OFFSET)
(KVE_FLAGS, KVE_PROTECTION, KVE_PATH, KINFO_VME_PROT_READ)
(KINFO_VME_PROT_WRITE, KINFO_VME_PROT_EXEC, KINFO_VME_FLAG_COW)
(KINFO_VME_FLAG_NEEDS_COPY, KINFO_VME_FLAG_NOCOREDUMP)
(KINFO_VME_FLAG_SUPER, KINFO_VME_FLAG_GROWS_UP)
(KINFO_VME_FLAG_GROWS_DOWN, KF_STRUCTSIZE, KF_TYPE, KF_FD)
(KF_PATH, KINFO_FILE_TYPE_VNODE, KINFO_FILE_FD_TYPE_CWD)
(KINFO_FILE_FD_TYPE_TEXT, SIG_WORDS, struct kinfo_proc_layout)
(kinfo_proc_layout_32, kinfo_proc_layout_i386)
(kinfo_proc_layout_64, fbsd_vm_map_entry_flags)
(fbsd_core_info_proc_mappings, fbsd_core_vnode_path)
(fbsd_core_fetch_timeval, fbsd_print_sigset)
(fbsd_core_info_proc_status, fbsd_core_info_proc): New.
(fbsd_init_abi): Install gdbarch "core_info_proc" method.
* fbsd-tdep.h (fbsd_vm_map_entry_flags): New.
2018-01-08 Samuel Thibault <samuel.thibault@ens-lyon.org>
* gdb/gnu-nat.c: Include <elf.h> and <link.h>.
(gnu_xfer_auxv): New function.
(gnu_xfer_partial): Call gnu_xfer_auxv when `object' is
TARGET_OBJECT_AUXV.
Fix GDB build failure when $development is false We don't build GDB selftests bits when $development is false. However, if we turn bfd/development.sh:$development to false, common/selftest.c is compiled which is not expected. It causes the build failure, selftest.o: In function `selftests::run_tests(char const*)': binutils-gdb/gdb/common/selftest.c:97: undefined reference to `selftests::reset()' collect2: error: ld returned 1 exit status I fix this issue by putting selftest.o selftest-arch.o into CONFIG_OBS only when $development is true. After this is fixed, there are other build failures in maint.c, this patch fixes them as well. In the release mode, the output of these commands are: (gdb) maintenance selftest Selftests are not available in a non-development build. (gdb) maintenance selftest foo Selftests are not available in a non-development build. (gdb) maintenance info selftests Selftests are not available in a non-development build. gdb: 2018-01-08 Yao Qi <yao.qi@linaro.org> Simon Marchi <simon.marchi@ericsson.com> * Makefile.in (COMMON_SFILES): Remove selftest-arch.c and common/selftest.c. (COMMON_OBS): Remove selftest.o. * configure.ac: Append selftest-arch.c and common/selftest.c to CONFIG_SRCS. Append selftest-arch.o and selftest.o to COMMON_OBS. * configure: Re-generated. * maint.c (maintenance_selftest): Wrap selftests::run_tests with GDB_SELF_TEST. (maintenance_info_selftests): Likewise. gdb/testsuite: 2018-01-08 Simon Marchi <simon.marchi@ericsson.com> * gdb.gdb/unittest.exp: Match output in non-development mode.
2018-01-08 11:09:32 +01:00
2018-01-08 Yao Qi <yao.qi@linaro.org>
Simon Marchi <simon.marchi@ericsson.com>
* Makefile.in (COMMON_SFILES): Remove selftest-arch.c and
common/selftest.c.
(COMMON_OBS): Remove selftest.o.
* configure.ac: Append selftest-arch.c and common/selftest.c to
CONFIG_SRCS. Append selftest-arch.o and selftest.o to COMMON_OBS.
* configure: Re-generated.
* maint.c (maintenance_selftest): Wrap selftests::run_tests with
GDB_SELF_TEST.
(maintenance_info_selftests): Likewise.
2018-01-08 Xavier Roirand <roirand@adacore.com>
* ada-valprint.c (val_print_packed_array_elements): Use
proper number of elements when printing an array indexed
by an enumeration type.
Remove dwarf2_cu::dwarf2_per_objfile This patch removes the dwarf2_per_objfile field of dwarf2_cu. It is redundant, since we can access dwarf2_per_objfile through dwarf2_per_objfile, which is guaranteed to be set. gdb/ChangeLog: * dwarf2read.c (struct dwarf2_cu) <dwarf2_per_objfile>: Remove. (dw2_get_file_names_reader): Adjust. (lookup_dwo_signatured_type): Adjust. (lookup_dwp_signatured_type): Adjust. (lookup_signatured_type): Adjust. (create_type_unit_group): Adjust. (get_type_unit_group): Adjust. (process_psymtab_comp_unit_reader): Adjust. (build_type_psymtabs_reader): Adjust. (scan_partial_symbols): Adjust. (add_partial_symbol): Adjust. (add_partial_subprogram): Adjust. (peek_die_abbrev): Adjust. (fixup_go_packaging): Adjust. (process_imported_unit_die): Adjust. (dwarf2_compute_name): Adjust. (dwarf2_physname): Adjust. (read_import_statement): Adjust. (handle_DW_AT_stmt_list): Adjust. (read_file_scope): Adjust. (read_func_scope): Adjust. (read_lexical_block_scope): Adjust. (read_call_site_scope): Adjust. (read_variable): Adjust. (dwarf2_rnglists_process): Adjust. (dwarf2_ranges_process): Adjust. (dwarf2_ranges_read): Adjust. (dwarf2_get_pc_bounds): Adjust. (dwarf2_record_block_ranges): Adjust. (dwarf2_add_field): Adjust. (dwarf2_add_member_fn): Adjust. (read_structure_type): Adjust. (process_structure_scope): Adjust. (read_enumeration_type): Adjust. (read_array_type): Adjust. (mark_common_block_symbol_computed): Adjust. (read_common_block): Adjust. (read_namespace_type): Adjust. (read_namespace): Adjust. (read_module_type): Adjust. (read_tag_pointer_type): Adjust. (read_tag_ptr_to_member_type): Adjust. (read_tag_string_type): Adjust. (read_subroutine_type): Adjust. (read_typedef): Adjust. (read_base_type): Adjust. (attr_to_dynamic_prop): Adjust. (read_subrange_type): Adjust. (read_unspecified_type): Adjust. (dwarf2_read_abbrevs): Adjust. (load_partial_dies): Adjust. (read_partial_die): Adjust. (find_partial_die): Adjust. (guess_partial_die_structure_name): Adjust. (fixup_partial_die): Adjust. (read_attribute_value): Adjust. (read_addr_index): Adjust. (read_addr_index_from_leb128): Adjust. (read_str_index): Adjust. (dwarf2_string_attr): Adjust. (get_debug_line_section): Adjust. (dwarf_decode_line_header): Adjust. (lnp_state_machine::check_line_address): Adjust. (dwarf_decode_lines_1): Adjust. (dwarf_decode_lines): Adjust. (dwarf2_start_symtab): Adjust. (var_decode_location): Adjust. (new_symbol_full): Adjust. (dwarf2_const_value_data): Adjust. (dwarf2_const_value_attr): Adjust. (dwarf2_const_value): Adjust. (die_type): Adjust. (die_containing_type): Adjust. (build_error_marker_type): Adjust. (lookup_die_type): Adjust. (guess_full_die_structure_name): Adjust. (anonymous_struct_prefix): Adjust. (determine_prefix): Adjust. (dwarf2_name): Adjust. (follow_die_ref_or_sig): Adjust. (follow_die_offset): Adjust. (follow_die_ref): Adjust. (follow_die_sig_1): Adjust. (follow_die_sig): Adjust. (get_signatured_type): Adjust. (get_DW_AT_signature_type): Adjust. (decode_locdesc): Adjust. (dwarf_decode_macros): Adjust. (cu_debug_loc_section): Adjust. (fill_in_loclist_baton): Adjust. (dwarf2_symbol_mark_computed): Adjust. (init_one_comp_unit): Don't assign dwarf2_cu::dwarf2_per_objfile. (set_die_type): Adjust.
2018-01-07 17:22:46 +01:00
2018-01-07 Simon Marchi <simon.marchi@polymtl.ca>
* dwarf2read.c (struct dwarf2_cu) <dwarf2_per_objfile>: Remove.
(dw2_get_file_names_reader): Adjust.
(lookup_dwo_signatured_type): Adjust.
(lookup_dwp_signatured_type): Adjust.
(lookup_signatured_type): Adjust.
(create_type_unit_group): Adjust.
(get_type_unit_group): Adjust.
(process_psymtab_comp_unit_reader): Adjust.
(build_type_psymtabs_reader): Adjust.
(scan_partial_symbols): Adjust.
(add_partial_symbol): Adjust.
(add_partial_subprogram): Adjust.
(peek_die_abbrev): Adjust.
(fixup_go_packaging): Adjust.
(process_imported_unit_die): Adjust.
(dwarf2_compute_name): Adjust.
(dwarf2_physname): Adjust.
(read_import_statement): Adjust.
(handle_DW_AT_stmt_list): Adjust.
(read_file_scope): Adjust.
(read_func_scope): Adjust.
(read_lexical_block_scope): Adjust.
(read_call_site_scope): Adjust.
(read_variable): Adjust.
(dwarf2_rnglists_process): Adjust.
(dwarf2_ranges_process): Adjust.
(dwarf2_ranges_read): Adjust.
(dwarf2_get_pc_bounds): Adjust.
(dwarf2_record_block_ranges): Adjust.
(dwarf2_add_field): Adjust.
(dwarf2_add_member_fn): Adjust.
(read_structure_type): Adjust.
(process_structure_scope): Adjust.
(read_enumeration_type): Adjust.
(read_array_type): Adjust.
(mark_common_block_symbol_computed): Adjust.
(read_common_block): Adjust.
(read_namespace_type): Adjust.
(read_namespace): Adjust.
(read_module_type): Adjust.
(read_tag_pointer_type): Adjust.
(read_tag_ptr_to_member_type): Adjust.
(read_tag_string_type): Adjust.
(read_subroutine_type): Adjust.
(read_typedef): Adjust.
(read_base_type): Adjust.
(attr_to_dynamic_prop): Adjust.
(read_subrange_type): Adjust.
(read_unspecified_type): Adjust.
(dwarf2_read_abbrevs): Adjust.
(load_partial_dies): Adjust.
(read_partial_die): Adjust.
(find_partial_die): Adjust.
(guess_partial_die_structure_name): Adjust.
(fixup_partial_die): Adjust.
(read_attribute_value): Adjust.
(read_addr_index): Adjust.
(read_addr_index_from_leb128): Adjust.
(read_str_index): Adjust.
(dwarf2_string_attr): Adjust.
(get_debug_line_section): Adjust.
(dwarf_decode_line_header): Adjust.
(lnp_state_machine::check_line_address): Adjust.
(dwarf_decode_lines_1): Adjust.
(dwarf_decode_lines): Adjust.
(dwarf2_start_symtab): Adjust.
(var_decode_location): Adjust.
(new_symbol_full): Adjust.
(dwarf2_const_value_data): Adjust.
(dwarf2_const_value_attr): Adjust.
(dwarf2_const_value): Adjust.
(die_type): Adjust.
(die_containing_type): Adjust.
(build_error_marker_type): Adjust.
(lookup_die_type): Adjust.
(guess_full_die_structure_name): Adjust.
(anonymous_struct_prefix): Adjust.
(determine_prefix): Adjust.
(dwarf2_name): Adjust.
(follow_die_ref_or_sig): Adjust.
(follow_die_offset): Adjust.
(follow_die_ref): Adjust.
(follow_die_sig_1): Adjust.
(follow_die_sig): Adjust.
(get_signatured_type): Adjust.
(get_DW_AT_signature_type): Adjust.
(decode_locdesc): Adjust.
(dwarf_decode_macros): Adjust.
(cu_debug_loc_section): Adjust.
(fill_in_loclist_baton): Adjust.
(dwarf2_symbol_mark_computed): Adjust.
(init_one_comp_unit): Don't assign
dwarf2_cu::dwarf2_per_objfile.
(set_die_type): Adjust.
Remove dwarf2_per_objfile global This patch removes the global variable dwarf2_per_objfile. This global variable is set at the various entry points of dwarf2read.c (using dw2_setup), and is referred to throughout the file. Instead of passing data between functions in global variables like this one, it would be better if the functions that depend on it either received it as argument or got it from the existing arguments they receive. For example, a function receiving a reference to a dwarf2_per_cu_data can access it from dwarf2_per_cu_data::dwarf2_per_objfile. This patch has been tested on the buildbot. gdb/ChangeLog: * dwarf2read.c (struct mapped_debug_names): Add constructor. <dwarf2_per_objfile>: New field. (dwarf2_per_objfile): Remove global. (get_dwarf2_per_objfile): New function. (set_dwarf2_per_objfile): New function. (dwarf2_build_psymtabs_hard): Change objfile parameter to dwarf2_per_objfile. (abbrev_table_read_table): Add dwarf2_per_objfile parameter. (read_abbrev_offset): Likewise. (read_indirect_string): Likewise. (read_indirect_line_string): Likewise. (read_indirect_string_at_offset): Likewise. (read_indirect_string_from_dwz): Likewise. (dwarf2_find_containing_comp_unit): Change objfile parameter to dwarf2_per_objfile. (age_cached_comp_units): Add dwarf2_per_objfile parameter. (create_all_comp_units): Change objfile parameter to dwarf2_per_objfile. (create_all_type_units): Likewise. (process_queue): Add dwarf2_per_objfile parameter. (read_and_check_comp_unit_head): Likewise. (lookup_dwo_unit_in_dwp): Likewise. (get_dwp_file): Likewise. (process_cu_includes): Likewise. (struct free_dwo_file_cleanup_data): New struct. (dwarf2_has_info): Use get_dwarf2_per_objfile and set_dwarf2_per_objfile. (dwarf2_get_dwz_file): Add dwarf2_per_objfile parameter. (dw2_do_instantiate_symtab): Get dwarf2_per_objfile from context, adjust calls. (dw2_instantiate_symtab): Likewise. (dw2_get_cutu): Add dwarf2_per_objfile parameter. (dw2_get_cu): Likewise. (create_cu_from_index_list): Change objfile parameter to dwarf2_per_objfile. (create_cus_from_index_list): Get dwarf2_per_objfile from context, adjust calls. (create_cus_from_index): Likewise. (create_signatured_type_table_from_index): Change objfile parameter to dwarf2_per_objfile. (create_signatured_type_table_from_debug_names): Change objfile parameter to dwarf2_per_objfile. (create_addrmap_from_index): Likewise. (create_addrmap_from_aranges): Likewise. (dwarf2_read_index): Use get_dwarf2_per_objfile, adjust calls. (dw2_setup): Remove. (dw2_get_file_names_reader): Get dwarf2_per_objfile from context. (dw2_find_last_source_symtab): Get dwarf2_per_objfile using get_dwarf2_per_objfile. (dw2_forget_cached_source_info): Likewise. (dw2_map_symtabs_matching_filename): Likewise. (struct dw2_symtab_iterator) <index>: Remove. <dwarf2_per_objfile>: New field. (dw2_symtab_iter_init): Replace index parameter with dwarf2_per_objfile. (dw2_symtab_iter_next): Use dwarf2_per_objfile from iter. (dw2_lookup_symbol): Use get_dwarf2_per_objfile and adjust. (dw2_print_stats): Likewise. (dw2_dump): Likewise. (dw2_expand_symtabs_for_function): Likewise. (dw2_expand_all_symtabs): Likewise. (dw2_expand_symtabs_with_fullname): Likewise. (dw2_expand_marked_cus): Replace index and objfile parameters with dwarf2_per_objfile. (dw_expand_symtabs_matching_file_matcher): Add dwarf2_per_objfile parameter and adjust calls. (dw2_expand_symtabs_matching): Use get_dwarf2_per_objfile and adjust calls. (dw2_find_pc_sect_compunit_symtab): Don't call dw2_setup. (dw2_map_symbol_filenames): Use get_dwarf2_per_objfile and adjust calls. (create_cus_from_debug_names_list): Replace objfile parameter with dwarf2_per_objfile and adjust calls. (create_cus_from_debug_names): Likewise. (dwarf2_read_debug_names): Likewise. (mapped_debug_names::namei_to_name): Adjust call. (dw2_debug_names_iterator::next): Likewise. (dw2_debug_names_iterator::find_vec_in_debug_names): Likewise. (dw2_debug_names_lookup_symbol): Use get_dwarf2_per_objfile. (dw2_debug_names_dump): Likewise. (dw2_debug_names_expand_symtabs_for_function): Likewise. (dw2_debug_names_expand_symtabs_matching): Likewise. (dwarf2_initialize_objfile): Likewise. (dwarf2_build_psymtabs): Likewise. (get_abbrev_section_for_cu): Get dwarf2_per_objfile from this_cu. (error_check_comp_unit_head): Add dwarf2_per_objfile parameter. (read_and_check_comp_unit_head): Likewise. (read_abbrev_offset): Likewise. (create_debug_type_hash_table): Likewise. (create_debug_types_hash_table): Likewise. (create_all_type_units): Replace objfile parameter with dwarf2_per_objfile. (add_type_unit): Add dwarf2_per_objfile parameter. (fill_in_sig_entry_from_dwo_entry): Replace objfile parameter with dwarf2_per_objfile. (lookup_dwo_signatured_type): Get dwarf2_per_objfile from cu. (lookup_dwp_signatured_type): Likewise. (lookup_signatured_type): Likewise. (read_cutu_die_from_dwo): Likewise. (init_tu_and_read_dwo_dies): Likewise. (init_cutu_and_read_dies): Likewise. (init_cutu_and_read_dies_no_follow): Likewise. (allocate_type_unit_groups_table): Add objfile parameter. (create_type_unit_group): Use dwarf2_per_objfile from cu. (get_type_unit_group): Likewise. (process_psymtab_comp_unit): Update call. (build_type_psymtabs_reader): Use dwarf2_per_objfile from cu. (build_type_psymtabs_1): Add dwarf2_per_objfile parameter. (print_tu_stats): Likewise. (build_type_psymtab_dependencies): Use dwarf2_per_objfile passed in void* parameter. (build_type_psymtabs): Change objfile parameter to dwarf2_per_objfile. (process_skeletonless_type_unit): Use dwarf2_per_objfile passed in void* parameter. (process_skeletonless_type_units): Change objfile parameter to dwarf2_per_objfile. (set_partial_user): Likewise. (dwarf2_build_psymtabs_hard): Likewise. (read_comp_units_from_section): Likewise. (create_all_comp_units): Likewise. (scan_partial_symbols): Update calls. (add_partial_symbol): Likewise. (dwarf2_read_symtab): Use get_dwarf2_per_objfile. (maybe_queue_comp_unit): Use dwarf2_read_symtab from cu. (process_queue): Add dwarf2_per_objfile parameter. (get_compunit_symtab): Use dwarf2_per_objfile from cu. (compute_compunit_symtab_includes): Likewise. (process_cu_includes): Add dwarf2_per_objfile parameter. (process_full_comp_unit): Use dwarf2_per_objfile from cu. (process_full_type_unit): Likewise. (process_imported_unit_die): Update call. (handle_DW_AT_stmt_list): Use dwarf2_per_objfile from cu. (read_file_scope): Likewise. (allocate_dwo_file_hash_table): Add objfile parameter. (lookup_dwo_file_slot): Add dwarf2_per_objfile parameter. (create_cus_hash_table): Likewise. (create_dwp_hash_table): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwp_v2_section): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (lookup_dwo_unit_in_dwp): Likewise. (try_open_dwop_file): Likewise. (open_dwo_file): Likewise. Use dwarf2_per_objfile from cu. (open_and_init_dwo_file): Use dwarf2_per_objfile from cu, update cleanup to include a reference to dwarf2_per_objfile. (open_dwp_file): Add dwarf2_per_objfile parameter. (open_and_init_dwp_file): Likewise. (get_dwp_file): Likewise. (lookup_dwo_cutu): Use dwarf2_per_objfile from cu. (queue_and_load_all_dwo_tus): Update call. (free_dwo_file_cleanup): Use dwarf2_per_objfile from cleanup data. (dwarf2_rnglists_process): Use dwarf2_per_objfile from cu. (dwarf2_ranges_process): Likewise. (dwarf2_get_pc_bounds): Likewise. (mark_common_block_symbol_computed): Likewise. (abbrev_table_read_table): Add dwarf2_per_objfile parameter. (dwarf2_read_abbrevs): Update call. (read_partial_die): Use dwarf2_per_objfile from cu. (find_partial_die): Likewise. (fixup_partial_die): Likewise. (read_attribute_value): Likewise. (read_indirect_string_at_offset_from): Add objfile parameter. (read_indirect_string_at_offset): Add dwarf2_per_objfile parameter. (read_indirect_string_from_dwz): Add objfile parameter. (read_indirect_string): Add objfile parameter. (read_addr_index_1): Add dwarf2_per_objfile parameter. (read_addr_index): Use dwarf2_per_objfile from cu. (dwarf2_read_addr_index): Use dwarf2_per_objfile from cu, don't call dw2_setup. (read_str_index): Use dwarf2_per_objfile from cu. (get_debug_line_section): Likewise. (read_formatted_entries): Add dwarf2_per_objfile parameter. (dwarf_decode_line_header): Use dwarf2_per_objfile from cu. (new_symbol_full): Use dwarf2_per_objfile from cu. (build_error_marker_type): Likewise. (lookup_die_type): Likewise. (determine_prefix): Likewise. (follow_die_offset): Likewise. (dwarf2_fetch_die_loc_sect_off): Use get_dwarf2_per_objfile. (dwarf2_fetch_constant_bytes): Don't call dw2_setup. (dwarf2_fetch_die_type_sect_off): Likewise. (dwarf2_get_die_type): Likewise. (follow_die_sig_1): Use dwarf2_per_objfile from cu. (get_signatured_type): Likewise. (get_DW_AT_signature_type): Likewise. (dwarf_decode_macro_bytes): Add dwarf2_per_objfile parameter. (dwarf_decode_macros): Use dwarf2_per_objfile from cu. (cu_debug_loc_section): Likewise. (fill_in_loclist_baton): Likewise. (dwarf2_symbol_mark_computed): Likewise. (dwarf2_find_containing_comp_unit): Change objfile parameter to dwarf2_per_objfile. (free_cached_comp_units): Use dwarf2_per_objfile passed in void* parameter. (age_cached_comp_units): Add dwarf2_per_objfile parameter. (free_one_cached_comp_unit): Use dwarf2_per_objfile from cu. (dwarf2_free_objfile): Use get_dwarf2_per_objfile. (set_die_type): Use dwarf2_free_objfile from cu. (get_die_type_at_offset): Likewise. (dwarf2_per_objfile_free): Don't assign global variable. (debug_names) <constructor>: Add dwarf2_per_objfile parameter, update m_debugstrlookup construction. (debug_names::debug_str_lookup): Add dwarf2_per_objfile parameter. <m_dwarf2_per_objfile>: New field. <lookup>: Use m_dwarf2_per_objfile. (check_dwarf64_offsets): Add dwarf2_per_objfile parameter. (psyms_seen_size): Likewise. (write_gdbindex): Replace objfile parameter with dwarf2_per_objfile. (write_debug_names): Likewise. (write_psymtabs_to_index): Likewise. (save_gdb_index_command): Use get_dwarf2_per_objfile, update calls.
2018-01-07 17:22:46 +01:00
2018-01-07 Simon Marchi <simon.marchi@ericsson.com>
* dwarf2read.c (struct mapped_debug_names): Add constructor.
<dwarf2_per_objfile>: New field.
(dwarf2_per_objfile): Remove global.
(get_dwarf2_per_objfile): New function.
(set_dwarf2_per_objfile): New function.
(dwarf2_build_psymtabs_hard): Change objfile parameter to
dwarf2_per_objfile.
(abbrev_table_read_table): Add dwarf2_per_objfile parameter.
(read_abbrev_offset): Likewise.
(read_indirect_string): Likewise.
(read_indirect_line_string): Likewise.
(read_indirect_string_at_offset): Likewise.
(read_indirect_string_from_dwz): Likewise.
(dwarf2_find_containing_comp_unit): Change objfile parameter to
dwarf2_per_objfile.
(age_cached_comp_units): Add dwarf2_per_objfile parameter.
(create_all_comp_units): Change objfile parameter to
dwarf2_per_objfile.
(create_all_type_units): Likewise.
(process_queue): Add dwarf2_per_objfile parameter.
(read_and_check_comp_unit_head): Likewise.
(lookup_dwo_unit_in_dwp): Likewise.
(get_dwp_file): Likewise.
(process_cu_includes): Likewise.
(struct free_dwo_file_cleanup_data): New struct.
(dwarf2_has_info): Use get_dwarf2_per_objfile and
set_dwarf2_per_objfile.
(dwarf2_get_dwz_file): Add dwarf2_per_objfile parameter.
(dw2_do_instantiate_symtab): Get dwarf2_per_objfile from
context, adjust calls.
(dw2_instantiate_symtab): Likewise.
(dw2_get_cutu): Add dwarf2_per_objfile parameter.
(dw2_get_cu): Likewise.
(create_cu_from_index_list): Change objfile parameter to
dwarf2_per_objfile.
(create_cus_from_index_list): Get dwarf2_per_objfile from
context, adjust calls.
(create_cus_from_index): Likewise.
(create_signatured_type_table_from_index): Change objfile
parameter to dwarf2_per_objfile.
(create_signatured_type_table_from_debug_names): Change objfile
parameter to dwarf2_per_objfile.
(create_addrmap_from_index): Likewise.
(create_addrmap_from_aranges): Likewise.
(dwarf2_read_index): Use get_dwarf2_per_objfile, adjust calls.
(dw2_setup): Remove.
(dw2_get_file_names_reader): Get dwarf2_per_objfile from
context.
(dw2_find_last_source_symtab): Get dwarf2_per_objfile using
get_dwarf2_per_objfile.
(dw2_forget_cached_source_info): Likewise.
(dw2_map_symtabs_matching_filename): Likewise.
(struct dw2_symtab_iterator) <index>: Remove.
<dwarf2_per_objfile>: New field.
(dw2_symtab_iter_init): Replace index parameter with
dwarf2_per_objfile.
(dw2_symtab_iter_next): Use dwarf2_per_objfile from iter.
(dw2_lookup_symbol): Use get_dwarf2_per_objfile and adjust.
(dw2_print_stats): Likewise.
(dw2_dump): Likewise.
(dw2_expand_symtabs_for_function): Likewise.
(dw2_expand_all_symtabs): Likewise.
(dw2_expand_symtabs_with_fullname): Likewise.
(dw2_expand_marked_cus): Replace index and objfile parameters
with dwarf2_per_objfile.
(dw_expand_symtabs_matching_file_matcher): Add
dwarf2_per_objfile parameter and adjust calls.
(dw2_expand_symtabs_matching): Use get_dwarf2_per_objfile and
adjust calls.
(dw2_find_pc_sect_compunit_symtab): Don't call dw2_setup.
(dw2_map_symbol_filenames): Use get_dwarf2_per_objfile and
adjust calls.
(create_cus_from_debug_names_list): Replace objfile parameter
with dwarf2_per_objfile and adjust calls.
(create_cus_from_debug_names): Likewise.
(dwarf2_read_debug_names): Likewise.
(mapped_debug_names::namei_to_name): Adjust call.
(dw2_debug_names_iterator::next): Likewise.
(dw2_debug_names_iterator::find_vec_in_debug_names): Likewise.
(dw2_debug_names_lookup_symbol): Use get_dwarf2_per_objfile.
(dw2_debug_names_dump): Likewise.
(dw2_debug_names_expand_symtabs_for_function): Likewise.
(dw2_debug_names_expand_symtabs_matching): Likewise.
(dwarf2_initialize_objfile): Likewise.
(dwarf2_build_psymtabs): Likewise.
(get_abbrev_section_for_cu): Get dwarf2_per_objfile from
this_cu.
(error_check_comp_unit_head): Add dwarf2_per_objfile parameter.
(read_and_check_comp_unit_head): Likewise.
(read_abbrev_offset): Likewise.
(create_debug_type_hash_table): Likewise.
(create_debug_types_hash_table): Likewise.
(create_all_type_units): Replace objfile parameter with
dwarf2_per_objfile.
(add_type_unit): Add dwarf2_per_objfile parameter.
(fill_in_sig_entry_from_dwo_entry): Replace objfile parameter
with dwarf2_per_objfile.
(lookup_dwo_signatured_type): Get dwarf2_per_objfile from cu.
(lookup_dwp_signatured_type): Likewise.
(lookup_signatured_type): Likewise.
(read_cutu_die_from_dwo): Likewise.
(init_tu_and_read_dwo_dies): Likewise.
(init_cutu_and_read_dies): Likewise.
(init_cutu_and_read_dies_no_follow): Likewise.
(allocate_type_unit_groups_table): Add objfile parameter.
(create_type_unit_group): Use dwarf2_per_objfile from cu.
(get_type_unit_group): Likewise.
(process_psymtab_comp_unit): Update call.
(build_type_psymtabs_reader): Use dwarf2_per_objfile from cu.
(build_type_psymtabs_1): Add dwarf2_per_objfile parameter.
(print_tu_stats): Likewise.
(build_type_psymtab_dependencies): Use dwarf2_per_objfile passed
in void* parameter.
(build_type_psymtabs): Change objfile parameter to
dwarf2_per_objfile.
(process_skeletonless_type_unit): Use dwarf2_per_objfile
passed in void* parameter.
(process_skeletonless_type_units): Change objfile parameter to
dwarf2_per_objfile.
(set_partial_user): Likewise.
(dwarf2_build_psymtabs_hard): Likewise.
(read_comp_units_from_section): Likewise.
(create_all_comp_units): Likewise.
(scan_partial_symbols): Update calls.
(add_partial_symbol): Likewise.
(dwarf2_read_symtab): Use get_dwarf2_per_objfile.
(maybe_queue_comp_unit): Use dwarf2_read_symtab from cu.
(process_queue): Add dwarf2_per_objfile parameter.
(get_compunit_symtab): Use dwarf2_per_objfile from cu.
(compute_compunit_symtab_includes): Likewise.
(process_cu_includes): Add dwarf2_per_objfile parameter.
(process_full_comp_unit): Use dwarf2_per_objfile from cu.
(process_full_type_unit): Likewise.
(process_imported_unit_die): Update call.
(handle_DW_AT_stmt_list): Use dwarf2_per_objfile from cu.
(read_file_scope): Likewise.
(allocate_dwo_file_hash_table): Add objfile parameter.
(lookup_dwo_file_slot): Add dwarf2_per_objfile parameter.
(create_cus_hash_table): Likewise.
(create_dwp_hash_table): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwp_v2_section): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(lookup_dwo_unit_in_dwp): Likewise.
(try_open_dwop_file): Likewise.
(open_dwo_file): Likewise. Use dwarf2_per_objfile from cu.
(open_and_init_dwo_file): Use dwarf2_per_objfile from cu, update
cleanup to include a reference to dwarf2_per_objfile.
(open_dwp_file): Add dwarf2_per_objfile parameter.
(open_and_init_dwp_file): Likewise.
(get_dwp_file): Likewise.
(lookup_dwo_cutu): Use dwarf2_per_objfile from cu.
(queue_and_load_all_dwo_tus): Update call.
(free_dwo_file_cleanup): Use dwarf2_per_objfile from cleanup
data.
(dwarf2_rnglists_process): Use dwarf2_per_objfile from cu.
(dwarf2_ranges_process): Likewise.
(dwarf2_get_pc_bounds): Likewise.
(mark_common_block_symbol_computed): Likewise.
(abbrev_table_read_table): Add dwarf2_per_objfile parameter.
(dwarf2_read_abbrevs): Update call.
(read_partial_die): Use dwarf2_per_objfile from cu.
(find_partial_die): Likewise.
(fixup_partial_die): Likewise.
(read_attribute_value): Likewise.
(read_indirect_string_at_offset_from): Add objfile parameter.
(read_indirect_string_at_offset): Add dwarf2_per_objfile
parameter.
(read_indirect_string_from_dwz): Add objfile parameter.
(read_indirect_string): Add objfile parameter.
(read_addr_index_1): Add dwarf2_per_objfile parameter.
(read_addr_index): Use dwarf2_per_objfile from cu.
(dwarf2_read_addr_index): Use dwarf2_per_objfile from cu, don't
call dw2_setup.
(read_str_index): Use dwarf2_per_objfile from cu.
(get_debug_line_section): Likewise.
(read_formatted_entries): Add dwarf2_per_objfile parameter.
(dwarf_decode_line_header): Use dwarf2_per_objfile from cu.
(new_symbol_full): Use dwarf2_per_objfile from cu.
(build_error_marker_type): Likewise.
(lookup_die_type): Likewise.
(determine_prefix): Likewise.
(follow_die_offset): Likewise.
(dwarf2_fetch_die_loc_sect_off): Use get_dwarf2_per_objfile.
(dwarf2_fetch_constant_bytes): Don't call dw2_setup.
(dwarf2_fetch_die_type_sect_off): Likewise.
(dwarf2_get_die_type): Likewise.
(follow_die_sig_1): Use dwarf2_per_objfile from cu.
(get_signatured_type): Likewise.
(get_DW_AT_signature_type): Likewise.
(dwarf_decode_macro_bytes): Add dwarf2_per_objfile parameter.
(dwarf_decode_macros): Use dwarf2_per_objfile from cu.
(cu_debug_loc_section): Likewise.
(fill_in_loclist_baton): Likewise.
(dwarf2_symbol_mark_computed): Likewise.
(dwarf2_find_containing_comp_unit): Change objfile parameter to
dwarf2_per_objfile.
(free_cached_comp_units): Use dwarf2_per_objfile passed in void*
parameter.
(age_cached_comp_units): Add dwarf2_per_objfile parameter.
(free_one_cached_comp_unit): Use dwarf2_per_objfile from cu.
(dwarf2_free_objfile): Use get_dwarf2_per_objfile.
(set_die_type): Use dwarf2_free_objfile from cu.
(get_die_type_at_offset): Likewise.
(dwarf2_per_objfile_free): Don't assign global variable.
(debug_names) <constructor>: Add dwarf2_per_objfile
parameter, update m_debugstrlookup construction.
(debug_names::debug_str_lookup): Add dwarf2_per_objfile
parameter.
<m_dwarf2_per_objfile>: New field.
<lookup>: Use m_dwarf2_per_objfile.
(check_dwarf64_offsets): Add dwarf2_per_objfile parameter.
(psyms_seen_size): Likewise.
(write_gdbindex): Replace objfile parameter with
dwarf2_per_objfile.
(write_debug_names): Likewise.
(write_psymtabs_to_index): Likewise.
(save_gdb_index_command): Use get_dwarf2_per_objfile, update
calls.
Replace objfile field in dwarf2_cu and dwarf2_per_cu_data with dwarf2_per_objfile The next patch aims to remove the dwarf2_per_objfile global. In many functions, we need to find a way to get a reference to the current dwarf2_per_objfile through the objects passed in parameters. Often, we have access to a dwarf2_cu or a dwarf2_per_cu_data. These objects have a reference to the objfile, through which we can get the dwarf2_per_objfile: dwarf2_per_objfile = ((struct dwarf2_per_objfile *) objfile_data (objfile, dwarf2_objfile_data_key)); However, this is a bit cumbersome to do all over the place. It would be more logical if the dwarf2_cu and dwarf2_per_cu_data had a reference to their dwarf2_per_objfile, which would then have a reference to the objfile. It would be more in line with the object hierarchy, where dwarf2_per_objfile owns the dwarf2_per_cu_data instances. We could even remove the reference dwarf2_cu has to dwarf2_per_objfile, since we can access dwarf2_per_objfile through dwarf2_cu::per_cu. In a graphical way, references would look like this after the current patch: objfile <--- dwarf2_per_objfile <--- dwarf2_per_cu_data | ^ | | `- dwarf2_cu This patch has been tested on the buildbot. gdb/ChangeLog: * dwarf2read.c (struct dwarf2_cu) <objfile>: Remove. <dwarf2_per_objfile>: New field. (struct dwarf2_per_cu_data) <objfile>: Remove. <dwarf2_per_objfile>: New field. (create_cu_from_index_list): Assign dwarf2_per_objfile instead of objfile. (create_signatured_type_table_from_index): Likewise. (create_debug_type_hash_table): Likewise. (fill_in_sig_entry_from_dwo_entry): Likewise. (lookup_dwo_unit): Access objfile through dwarf2_per_objfile. (create_type_unit_group): Assign dwarf2_per_objfile instead of objfile. (create_partial_symtab): Access objfile through dwarf2_per_objfile. (process_psymtab_comp_unit_reader): Likewise. (read_comp_units_from_section): Likewise. (scan_partial_symbols): Likewise. (add_partial_symbol): Likewise. (add_partial_subprogram): Likewise. (peek_die_abbrev): Likewise. (fixup_go_packaging): Likewise. (process_full_comp_unit): Likewise. (process_full_type_unit): Likewise. (process_imported_unit_die): Likewise. (dwarf2_compute_name): Likewise. (dwarf2_physname): Likewise. (read_import_statement): Likewise. (create_cus_hash_table): Assign dwarf2_physname instead of objfile. (read_func_scope): Access objfile through dwarf2_per_objfile. (read_lexical_block_scope): Likewise. (read_call_site_scope): Likewise. (read_variable): Likewise. (dwarf2_rnglists_process): Likewise. (dwarf2_ranges_process): Likewise. (dwarf2_ranges_read): Likewise. (dwarf2_record_block_ranges): Likewise. (dwarf2_add_field): Likewise. (dwarf2_add_member_fn): Likewise. (read_structure_type): Likewise. (process_structure_scope): Likewise. (read_enumeration_type): Likewise. (read_array_type): Likewise. (read_common_block): Likewise. (read_namespace_type): Likewise. (read_namespace): Likewise. (read_module_type): Likewise. (read_tag_pointer_type): Likewise. (read_tag_ptr_to_member_type): Likewise. (read_tag_string_type): Likewise. (read_subroutine_type): Likewise. (read_typedef): Likewise. (read_base_type): Likewise. (attr_to_dynamic_prop): Likewise. (read_subrange_type): Likewise. (read_unspecified_type): Likewise. (load_partial_dies): Likewise. (read_partial_die): Likewise. (find_partial_die): Likewise. (guess_partial_die_structure_name): Likewise. (fixup_partial_die): Likewise. (read_attribute_value): Likewise. (read_addr_index_from_leb128): Likewise. (dwarf2_read_addr_index): Likewise. (dwarf2_string_attr): Likewise. (lnp_state_machine::check_line_address): Likewise. (dwarf_decode_lines_1): Likewise. (dwarf_decode_lines): Likewise. (dwarf2_start_symtab): Likewise. (var_decode_location): Likewise. (new_symbol_full): Likewise. (dwarf2_const_value_data): Likewise. (dwarf2_const_value_attr): Likewise. (dwarf2_const_value): Likewise. (die_type): Likewise. (die_containing_type): Likewise. (lookup_die_type): Likewise. (guess_full_die_structure_name): Likewise. (anonymous_struct_prefix): Likewise. (dwarf2_name): Likewise. (follow_die_ref_or_sig): Likewise. (follow_die_offset): Likewise. (follow_die_ref): Likewise. (dwarf2_fetch_die_loc_sect_off): Likewise. (dwarf2_fetch_constant_bytes): Likewise. (dwarf2_fetch_die_type_sect_off): Likewise. (dwarf2_get_die_type): Likewise. (follow_die_sig): Likewise. (decode_locdesc): Likewise. (dwarf2_per_cu_objfile): Likewise. (dwarf2_per_cu_text_offset): Likewise. (init_one_comp_unit): Assign dwarf2_per_objfile instead of objfile. (set_die_type): Access objfile through dwarf2_per_objfile.
2018-01-07 17:22:45 +01:00
2018-01-07 Simon Marchi <simon.marchi@ericsson.com>
* dwarf2read.c (struct dwarf2_cu) <objfile>: Remove.
<dwarf2_per_objfile>: New field.
(struct dwarf2_per_cu_data) <objfile>: Remove.
<dwarf2_per_objfile>: New field.
(create_cu_from_index_list): Assign dwarf2_per_objfile instead
of objfile.
(create_signatured_type_table_from_index): Likewise.
(create_debug_type_hash_table): Likewise.
(fill_in_sig_entry_from_dwo_entry): Likewise.
(lookup_dwo_unit): Access objfile through dwarf2_per_objfile.
(create_type_unit_group): Assign dwarf2_per_objfile instead of
objfile.
(create_partial_symtab): Access objfile through
dwarf2_per_objfile.
(process_psymtab_comp_unit_reader): Likewise.
(read_comp_units_from_section): Likewise.
(scan_partial_symbols): Likewise.
(add_partial_symbol): Likewise.
(add_partial_subprogram): Likewise.
(peek_die_abbrev): Likewise.
(fixup_go_packaging): Likewise.
(process_full_comp_unit): Likewise.
(process_full_type_unit): Likewise.
(process_imported_unit_die): Likewise.
(dwarf2_compute_name): Likewise.
(dwarf2_physname): Likewise.
(read_import_statement): Likewise.
(create_cus_hash_table): Assign dwarf2_physname instead of
objfile.
(read_func_scope): Access objfile through dwarf2_per_objfile.
(read_lexical_block_scope): Likewise.
(read_call_site_scope): Likewise.
(read_variable): Likewise.
(dwarf2_rnglists_process): Likewise.
(dwarf2_ranges_process): Likewise.
(dwarf2_ranges_read): Likewise.
(dwarf2_record_block_ranges): Likewise.
(dwarf2_add_field): Likewise.
(dwarf2_add_member_fn): Likewise.
(read_structure_type): Likewise.
(process_structure_scope): Likewise.
(read_enumeration_type): Likewise.
(read_array_type): Likewise.
(read_common_block): Likewise.
(read_namespace_type): Likewise.
(read_namespace): Likewise.
(read_module_type): Likewise.
(read_tag_pointer_type): Likewise.
(read_tag_ptr_to_member_type): Likewise.
(read_tag_string_type): Likewise.
(read_subroutine_type): Likewise.
(read_typedef): Likewise.
(read_base_type): Likewise.
(attr_to_dynamic_prop): Likewise.
(read_subrange_type): Likewise.
(read_unspecified_type): Likewise.
(load_partial_dies): Likewise.
(read_partial_die): Likewise.
(find_partial_die): Likewise.
(guess_partial_die_structure_name): Likewise.
(fixup_partial_die): Likewise.
(read_attribute_value): Likewise.
(read_addr_index_from_leb128): Likewise.
(dwarf2_read_addr_index): Likewise.
(dwarf2_string_attr): Likewise.
(lnp_state_machine::check_line_address): Likewise.
(dwarf_decode_lines_1): Likewise.
(dwarf_decode_lines): Likewise.
(dwarf2_start_symtab): Likewise.
(var_decode_location): Likewise.
(new_symbol_full): Likewise.
(dwarf2_const_value_data): Likewise.
(dwarf2_const_value_attr): Likewise.
(dwarf2_const_value): Likewise.
(die_type): Likewise.
(die_containing_type): Likewise.
(lookup_die_type): Likewise.
(guess_full_die_structure_name): Likewise.
(anonymous_struct_prefix): Likewise.
(dwarf2_name): Likewise.
(follow_die_ref_or_sig): Likewise.
(follow_die_offset): Likewise.
(follow_die_ref): Likewise.
(dwarf2_fetch_die_loc_sect_off): Likewise.
(dwarf2_fetch_constant_bytes): Likewise.
(dwarf2_fetch_die_type_sect_off): Likewise.
(dwarf2_get_die_type): Likewise.
(follow_die_sig): Likewise.
(decode_locdesc): Likewise.
(dwarf2_per_cu_objfile): Likewise.
(dwarf2_per_cu_text_offset): Likewise.
(init_one_comp_unit): Assign dwarf2_per_objfile instead of
objfile.
(set_die_type): Access objfile through
dwarf2_per_objfile.
2018-01-07 Simon Marchi <simon.marchi@ericsson.com>
* valprint.c (converted_character_d): Remove typedef.
(DEF_VEC_O (converted_character_d)): Remove.
(count_next_character): Use std::vector.
(print_converted_chars_to_obstack): Likewise.
(generic_printstr): Likewise.
Replace VEC(gdb_xml_value_s) with std::vector This patch replaces VEC(gdb_xml_value_s), which is passed to XML visitors, with an std::vector. In order to be able to remove the cleanup in gdb_xml_parser::start_element, the gdb_xml_parser structure is made to own the value with a gdb::unique_xmalloc_ptr. This patch has been tested on the buildbot. gdb/ChangeLog: * xml-support.h (struct gdb_xml_value): Add constructor. <value>: Change type to unique_xmalloc_ptr. (gdb_xml_value_s): Remove typedef. (DEF_VEC_O (gdb_xml_value_s)): Remove. (gdb_xml_element_start_handler): Change parameter type to std::vector. (xml_find_attribute): Likewise. * xml-support.c (xml_find_attribute): Change parameter type to std::vector and adjust. (gdb_xml_values_cleanup): Remove. (gdb_xml_parser::start_element): Adjust to std::vector. (xinclude_start_include): Change paraeter type to std::vector and adjust. * btrace.c (check_xml_btrace_version): Likewise. (parse_xml_btrace_block): Likewise. (parse_xml_btrace_pt_config_cpu): Likewise. (parse_xml_btrace_pt): Likewise. (parse_xml_btrace_conf_bts): Likewise. (parse_xml_btrace_conf_pt): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_start_property): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. * remote.c (start_thread): Likewise. * solib-aix.c (library_list_start_library): Likewise. (library_list_start_list): Likewise. * solib-svr4.c (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. * tracepoint.c (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. * xml-syscall.c (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_enum): Likewise. (tdesc_start_field): Likewise. (tdesc_start_enum_value): Likewise. (tdesc_start_vector): Likewise.
2018-01-07 15:29:52 +01:00
2018-01-07 Simon Marchi <simon.marchi@polymtl.ca>
* xml-support.h (struct gdb_xml_value): Add constructor.
<value>: Change type to unique_xmalloc_ptr.
(gdb_xml_value_s): Remove typedef.
(DEF_VEC_O (gdb_xml_value_s)): Remove.
(gdb_xml_element_start_handler): Change parameter type to
std::vector.
(xml_find_attribute): Likewise.
* xml-support.c (xml_find_attribute): Change parameter type to
std::vector and adjust.
(gdb_xml_values_cleanup): Remove.
(gdb_xml_parser::start_element): Adjust to std::vector.
(xinclude_start_include): Change paraeter type to std::vector
and adjust.
* btrace.c (check_xml_btrace_version): Likewise.
(parse_xml_btrace_block): Likewise.
(parse_xml_btrace_pt_config_cpu): Likewise.
(parse_xml_btrace_pt): Likewise.
(parse_xml_btrace_conf_bts): Likewise.
(parse_xml_btrace_conf_pt): Likewise.
* memory-map.c (memory_map_start_memory): Likewise.
(memory_map_start_property): Likewise.
* osdata.c (osdata_start_osdata): Likewise.
(osdata_start_item): Likewise.
(osdata_start_column): Likewise.
* remote.c (start_thread): Likewise.
* solib-aix.c (library_list_start_library): Likewise.
(library_list_start_list): Likewise.
* solib-svr4.c (library_list_start_library): Likewise.
(svr4_library_list_start_list): Likewise.
* solib-target.c (library_list_start_segment): Likewise.
(library_list_start_section): Likewise.
(library_list_start_library): Likewise.
(library_list_start_list): Likewise.
* tracepoint.c (traceframe_info_start_memory): Likewise.
(traceframe_info_start_tvar): Likewise.
* xml-syscall.c (syscall_start_syscall): Likewise.
* xml-tdesc.c (tdesc_start_target): Likewise.
(tdesc_start_feature): Likewise.
(tdesc_start_reg): Likewise.
(tdesc_start_union): Likewise.
(tdesc_start_struct): Likewise.
(tdesc_start_flags): Likewise.
(tdesc_start_enum): Likewise.
(tdesc_start_field): Likewise.
(tdesc_start_enum_value): Likewise.
(tdesc_start_vector): Likewise.
2018-01-07 Simon Marchi <simon.marchi@polymtl.ca>
* extension.h (struct xmethod_worker) <clone>: Remove.
* python/py-xmethods.c (struct python_xmethod_worker) <clone>:
Remove.
(python_xmethod_worker::clone): Remove.
* valops.c (find_overload_match): Use std::move instead of
clone.
C++ify xmethod_worker, get rid of VEC(xmethod_worker_ptr) The initial goal of this patch was to remove the usage of VEC(xmethod_worker_ptr) and corresponding cleanups. I ended up having to C++ify the xmethod_worker code, to be able to have xmethod_workers free their data in destructors, and therefore be able to use vectors of xmethod_worker unique_ptr. The operations in extension_language_ops that act on one instance of xmethod_worker (get result type, get args type, invoke) are transformed to methods of xmethod_worker. xmethod_worker becomes an abstract base class with virtual pure methods which python_xmethod_worker implements. The only xmethod-related operation left in extension_language_ops is get_matching_xmethod_workers, which returns a list of xmethod_workers. The changes are relatively straightforward, but here are some notes on things that may raise eyebrows: - I was not really comfortable with the value_of_xmethod function. At first it looks like a simple getter, so I considered making it a method of xmethod_worker. But actually it creates a value and transfers the ownership of the xmethod_worker to it. It would be a bit weird and error-prone if calling a method on an object silently removed the ownership of the object from the caller. To reflect the behavior more accurately, I renamed it to value_from_xmethod and made it accept an rvalue-reference (so the caller knows it gives away the ownership). I noticed the backlink from xmethod_worker to its owning value was not used, so I removed it. - Some code, like get_matching_xmethod_workers, made each callee fill a new vector, which was then merged in the result vector. I think it's safe if we always pass the same vector around, and each implementation just appends to it. - The clone operation does not seem particularly useful, it is removed in the following patch. gdb/ChangeLog: * extension-priv.h (enum ext_lang_rc): Remove, move to extension.h. (struct extension_language_ops) <clone_xmethod_worker_data>: Remove. <free_xmethod_worker_data>: Remove. <get_matching_xmethod_workers>: Chance VEC to std::vector. <get_xmethod_arg_types>: Remove. <get_xmethod_result_type>: Remove. <invoke_xmethod>: Remove. * extension.c (new_xmethod_worker): Remove. (clone_xmethod_worker): Remove. (get_matching_xmethod_workers): Return void, pass std::vector by pointer. (get_xmethod_arg_types): Rename to... (xmethod_worker::get_arg_types): ... this, and adjust. (get_xmethod_result_type): Rename to... (xmethod_worker::get_result_type): ... this, and adjust. (invoke_xmethod): Remove. (free_xmethod_worker): Remove. (free_xmethod_worker_vec): Remove. * extension.h (enum ext_lang_rc): Move here from extension-priv.h. (struct xmethod_worker): Add constructor and destructor. <data>: Remove. <value>: Remove. <invoke, clone, do_get_result_type, do_get_arg_types>: New virtual pure methods. <get_arg_types, get_result_type>: New methods. (xmethod_worker_ptr): Remove typedef. (DEF_VEC_P (xmethod_worker_ptr)): Remove. (xmethod_worker_vec): Remove typedef. (xmethod_worker_up): New typedef. (invoke_xmethod): Remove. (clone_xmethod_worker): Remove. (free_xmethod_worker): Remove. (free_xmethod_worker_vec): Remove. (get_xmethod_arg_types): Remove. (get_xmethod_result_type): Remove. * valops.c (find_method_list): Use std::vector, don't use intermediate vector. (value_find_oload_method_list): Use std::vector. (find_overload_match): Use std::vector. (find_oload_champ): Use std::vector. * value.c (value_free): Use operator delete. (value_of_xmethod): Rename to... (value_from_xmethod): ... this. Don't assign xmethod_worker::value, take rvalue-reference. (result_type_of_xmethod): Adjust. (call_xmethod): Adjust. * value.h: Include extension.h. (struct xmethod_worker): Don't forward-declare. (value_of_xmethod): Rename to... (value_from_xmethod): ... this, take rvalue-reference. * python/py-xmethods.c (struct gdbpy_worker_data): Rename to... (struct python_xmethod_worker): ... this, add constructor and destructor. <invoke, clone, do_get_arg_types, do_get_result_type>: Implement. (gdbpy_free_xmethod_worker_data): Rename to... (python_xmethod_worker::~python_xmethod_worker): ... this and adjust. (gdbpy_clone_xmethod_worker_data): Rename to... (python_xmethod_worker::clone): ... this and adjust. (gdbpy_get_matching_xmethod_workers): Use std::vector, don't use temporary vector. (gdbpy_get_xmethod_arg_types): Rename to... (python_xmethod_worker::do_get_arg_types): ... this and adjust. (gdbpy_get_xmethod_result_type): Rename to... (python_xmethod_worker::do_get_result_type): ... this and adjust. (gdbpy_invoke_xmethod): Rename to... (python_xmethod_worker::invoke): ... this and adjust. (new_python_xmethod_worker): Rename to... (python_xmethod_worker::python_xmethod_worker): ... this and adjust. * python/python-internal.h (gdbpy_clone_xmethod_worker_data): Remove. (gdbpy_free_xmethod_worker_data): Remove. (gdbpy_get_matching_xmethod_workers): Use std::vector. (gdbpy_get_xmethod_arg_types): Remove. (gdbpy_get_xmethod_result_type): Remove. (gdbpy_invoke_xmethod): Remove. * python/python.c (python_extension_ops): Remove obsolete callbacks.
2018-01-07 15:25:32 +01:00
2018-01-07 Simon Marchi <simon.marchi@polymtl.ca>
* extension-priv.h (enum ext_lang_rc): Remove, move to extension.h.
(struct extension_language_ops) <clone_xmethod_worker_data>: Remove.
<free_xmethod_worker_data>: Remove.
<get_matching_xmethod_workers>: Chance VEC to std::vector.
<get_xmethod_arg_types>: Remove.
<get_xmethod_result_type>: Remove.
<invoke_xmethod>: Remove.
* extension.c (new_xmethod_worker): Remove.
(clone_xmethod_worker): Remove.
(get_matching_xmethod_workers): Return void, pass std::vector by
pointer.
(get_xmethod_arg_types): Rename to...
(xmethod_worker::get_arg_types): ... this, and adjust.
(get_xmethod_result_type): Rename to...
(xmethod_worker::get_result_type): ... this, and adjust.
(invoke_xmethod): Remove.
(free_xmethod_worker): Remove.
(free_xmethod_worker_vec): Remove.
* extension.h (enum ext_lang_rc): Move here from
extension-priv.h.
(struct xmethod_worker): Add constructor and destructor.
<data>: Remove.
<value>: Remove.
<invoke, clone, do_get_result_type, do_get_arg_types>: New
virtual pure methods.
<get_arg_types, get_result_type>: New methods.
(xmethod_worker_ptr): Remove typedef.
(DEF_VEC_P (xmethod_worker_ptr)): Remove.
(xmethod_worker_vec): Remove typedef.
(xmethod_worker_up): New typedef.
(invoke_xmethod): Remove.
(clone_xmethod_worker): Remove.
(free_xmethod_worker): Remove.
(free_xmethod_worker_vec): Remove.
(get_xmethod_arg_types): Remove.
(get_xmethod_result_type): Remove.
* valops.c (find_method_list): Use std::vector, don't use
intermediate vector.
(value_find_oload_method_list): Use std::vector.
(find_overload_match): Use std::vector.
(find_oload_champ): Use std::vector.
* value.c (value_free): Use operator delete.
(value_of_xmethod): Rename to...
(value_from_xmethod): ... this. Don't assign
xmethod_worker::value, take rvalue-reference.
(result_type_of_xmethod): Adjust.
(call_xmethod): Adjust.
* value.h: Include extension.h.
(struct xmethod_worker): Don't forward-declare.
(value_of_xmethod): Rename to...
(value_from_xmethod): ... this, take rvalue-reference.
* python/py-xmethods.c (struct gdbpy_worker_data): Rename to...
(struct python_xmethod_worker): ... this, add constructor and
destructor.
<invoke, clone, do_get_arg_types, do_get_result_type>: Implement.
(gdbpy_free_xmethod_worker_data): Rename to...
(python_xmethod_worker::~python_xmethod_worker): ... this and
adjust.
(gdbpy_clone_xmethod_worker_data): Rename to...
(python_xmethod_worker::clone): ... this and adjust.
(gdbpy_get_matching_xmethod_workers): Use std::vector, don't use
temporary vector.
(gdbpy_get_xmethod_arg_types): Rename to...
(python_xmethod_worker::do_get_arg_types): ... this and adjust.
(gdbpy_get_xmethod_result_type): Rename to...
(python_xmethod_worker::do_get_result_type): ... this and
adjust.
(gdbpy_invoke_xmethod): Rename to...
(python_xmethod_worker::invoke): ... this and adjust.
(new_python_xmethod_worker): Rename to...
(python_xmethod_worker::python_xmethod_worker): ... this and
adjust.
* python/python-internal.h (gdbpy_clone_xmethod_worker_data):
Remove.
(gdbpy_free_xmethod_worker_data): Remove.
(gdbpy_get_matching_xmethod_workers): Use std::vector.
(gdbpy_get_xmethod_arg_types): Remove.
(gdbpy_get_xmethod_result_type): Remove.
(gdbpy_invoke_xmethod): Remove.
* python/python.c (python_extension_ops): Remove obsolete
callbacks.
Fix regression: cannot start with LD_PRELOAD=libSegFault.so (PR gdb/18653#c7) At https://sourceware.org/bugzilla/show_bug.cgi?id=18653#c7, Andrew reports that the fix for PR gdb/18653 made GDB useless if you preload libSegFault.so, because GDB internal-errors on startup: $ LD_PRELOAD=libSegFault.so gdb src/gdb/common/signals-state-save-restore.c:64: internal-error: unexpected signal handler A problem internal to GDB has been detected, further debugging may prove unreliable. Aborted (core dumped) $ The internal error comes from the code saving the signal dispositions inherited from gdb's parent: (top-gdb) bt #0 0x000000000056b001 in internal_error(char const*, int, char const*, ...) (file=0xaf5f38 "src/gdb/common/signals-state-save-restore.c", line=64, fmt=0xaf5f18 "unexpected signal handler") at src/gdb/common/errors.c:54 #1 0x00000000005752c9 in save_original_signals_state() () at src/gdb/common/signals-state-save-restore.c:64 #2 0x00000000007425de in captured_main_1(captured_main_args*) (context=0x7fffffffd860) at src/gdb/main.c:509 #3 0x0000000000743622 in captured_main(void*) (data=0x7fffffffd860) at src/gdb/main.c:1145 During symbol reading, cannot get low and high bounds for subprogram DIE at 24065. #4 0x00000000007436f9 in gdb_main(captured_main_args*) (args=0x7fffffffd860) at src/gdb/main.c:1171 #5 0x0000000000413acd in main(int, char**) (argc=1, argv=0x7fffffffd968) at src/gdb/gdb.c:32 This commit downgrades the internal error to a warning. You'll get instead: ~~~ $ LD_PRELOAD=libSegFault.so gdb warning: Found custom handler for signal 11 (Segmentation fault) preinstalled. Some signal dispositions inherited from the environment (SIG_DFL/SIG_IGN) won't be propagated to spawned programs. GNU gdb (GDB) 8.0.50.20171213-git Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... (gdb) ~~~ This also moves the location where save_original_signals_state is called a bit further below (to after option processing), so that "-q" disables the warning: ~~~ $ LD_PRELOAD=libSegFault.so gdb -q (gdb) ~~~ New testcase included. gdb/ChangeLog: 2018-01-05 Pedro Alves <palves@redhat.com> PR gdb/18653 * common/signals-state-save-restore.c (save_original_signals_state): New parameter 'quiet'. Warn if we find a custom handler preinstalled, instead of internal erroring. But only warn if !quiet. * common/signals-state-save-restore.h (save_original_signals_state): New parameter 'quiet'. * main.c (captured_main_1): Move save_original_signals_state call after option handling, and pass QUIET. gdb/gdbserver/ChangeLog: 2018-01-05 Pedro Alves <palves@redhat.com> PR gdb/18653 * server.c (captured_main): Pass quiet=false to save_original_signals_state. gdb/testsuite/ChangeLog: 2018-01-05 Pedro Alves <palves@redhat.com> PR gdb/18653 * gdb.base/libsegfault.exp: New.
2018-01-05 19:26:18 +01:00
2018-01-05 Pedro Alves <palves@redhat.com>
PR gdb/18653
* common/signals-state-save-restore.c
(save_original_signals_state): New parameter 'quiet'. Warn if we
find a custom handler preinstalled, instead of internal erroring.
But only warn if !quiet.
* common/signals-state-save-restore.h
(save_original_signals_state): New parameter 'quiet'.
* main.c (captured_main_1): Move save_original_signals_state call
after option handling, and pass QUIET.
2018-01-05 Pedro Alves <palves@redhat.com>
* spu-tdep.c (spu_catch_start): Pass
symbol_name_match_type::SEARCH_NAME to block_lookup_symbol.
Fix regresssion(internal-error) printing subprogram argument (PR gdb/22670) At <https://sourceware.org/ml/gdb-patches/2017-12/msg00298.html>, Joel wrote: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider the following code which first declares a tagged type (the equivalent of a class in Ada), and then a procedure which takes a pointer (access) to this type's 'Class. package Pck is type Top_T is tagged record N : Integer := 1; end record; procedure Inspect (Obj: access Top_T'Class); end Pck; Putting a breakpoint in that procedure and then running to it triggers an internal error: (gdb) break inspect (gdb) continue Breakpoint 1, pck.inspect (obj=0x63e010 /[...]/gdb/stack.c:621: internal-error: void print_frame_args(symbol*, frame_info*, int, ui_file*): Assertion `nsym != NULL' failed. What's special about this subprogram is that it takes an access to what we call a 'Class type, and for implementation reasons, the compiler adds an extra argument named "objL". If you are curious why, it allows the compiler for perform dynamic accessibility checks that are mandated by the language. If we look at the location where we get the internal error (in stack.c), we find that we are looping over the symbol of each parameter, and for each parameter, we do: /* We have to look up the symbol because arguments can have two entries (one a parameter, one a local) and the one we want is the local, which lookup_symbol will find for us. [...] nsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym), b, VAR_DOMAIN, NULL).symbol; gdb_assert (nsym != NULL); The lookup_symbol goes through the lookup structure, which means the symbol's linkage name ("objL") gets transformed into a lookup_name_info object (in block_lookup_symbol), before it gets fed to the block symbol dictionary iterators. This, in turn, triggers the symbol matching by comparing the "lookup" name which, for Ada, means among other things, lowercasing the given name to "objl". It is this transformation that causes the lookup find no matches, and therefore trip this assertion. Going back to the "offending" call to lookup_symbol in stack.c, what we are trying to do, here, is do a lookup by linkage name. So, I think what we mean to be doing is a completely literal symbol lookup, so maybe not even strcmp_iw, but actually just plain strcmp??? In the past, in practice, you could get that effect by doing a lookup using the C language. But that doesn't work, because we still end up somehow using Ada's lookup_name routine which transforms "objL". So, ideally, as I hinted before, I think what we need is a way to perform a literal lookup so that searches by linkage names like the above can be performed. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This commit fixes the problem by implementing something similar to Joel's literal idea, but with some important differences. I considered adding a symbol_name_match_type::LINKAGE and supporting searching by linkage name for any language, but the problem with that is that the dictionaries only work with SYMBOL_SEARCH_NAME, because that's what is used for hashing. We'd need separate dictionaries for hashed linkage names. So with the current symbol tables infrastructure, it's not literal linkage names that we want to pass down, but instead literal _search_ names (SYMBOL_SEARCH_NAME, etc.). However, psymbols have no overload/function parameter info in C++, so a straight strcmp doesn't work properly for C++ name matching. So what we do is be a little less aggressive then and add a new symbol_name_match_type::SEARCH_SYMBOL instead that takes as input a non-user-input search symbol, and then we skip any decoding/demangling steps and make: - Ada treat that as a verbatim match, - other languages treat it as symbol_name_match_type::FULL. This also fixes the new '"maint check-psymtabs" for Ada' testcase for me (gdb.ada/maint_with_ada.exp). I've not removed the kfail yet because Joel still sees that testcase failing with this patch. That'll be fixed in follow up patches. gdb/ChangeLog: 2018-01-05 Pedro Alves <palves@redhat.com> PR gdb/22670 * ada-lang.c (literal_symbol_name_matcher): New function. (ada_get_symbol_name_matcher): Use it for symbol_name_match_type::SEARCH_NAME. * block.c (block_lookup_symbol): New parameter 'match_type'. Pass it down instead of assuming symbol_name_match_type::FULL. * block.h (block_lookup_symbol): New parameter 'match_type'. * c-valprint.c (print_unpacked_pointer): Use lookup_symbol_search_name instead of lookup_symbol. * compile/compile-object-load.c (get_out_value_type): Pass down symbol_name_match_type::SEARCH_NAME. * cp-namespace.c (cp_basic_lookup_symbol): Pass down symbol_name_match_type::FULL. * cp-support.c (cp_get_symbol_name_matcher): Handle symbol_name_match_type::SEARCH_NAME. * infrun.c (insert_exception_resume_breakpoint): Use lookup_symbol_search_name. * p-valprint.c (pascal_val_print): Use lookup_symbol_search_name. * psymtab.c (maintenance_check_psymtabs): Use symbol_name_match_type::SEARCH_NAME and SYMBOL_SEARCH_NAME. * stack.c (print_frame_args): Use lookup_symbol_search_name and SYMBOL_SEARCH_NAME. * symtab.c (lookup_local_symbol): Don't demangle the lookup name if symbol_name_match_type::SEARCH_NAME. (lookup_symbol_in_language): Pass down symbol_name_match_type::FULL. (lookup_symbol_search_name): New. (lookup_language_this): Pass down symbol_name_match_type::SEARCH_NAME. (lookup_symbol_aux, lookup_local_symbol): New parameter 'match_type'. Pass it down. * symtab.h (symbol_name_match_type::SEARCH_NAME): New enumerator. (lookup_symbol_search_name): New declaration. (lookup_symbol_in_block): New 'match_type' parameter. gdb/testsuite/ChangeLog: 2018-01-05 Joel Brobecker <brobecker@adacore.com> PR gdb/22670 * gdb.ada/access_tagged_param.exp: New file. * gdb.ada/access_tagged_param/foo.adb: New file.
2018-01-05 15:04:09 +01:00
2018-01-05 Pedro Alves <palves@redhat.com>
PR gdb/22670
* ada-lang.c (literal_symbol_name_matcher): New function.
(ada_get_symbol_name_matcher): Use it for
symbol_name_match_type::SEARCH_NAME.
* block.c (block_lookup_symbol): New parameter 'match_type'. Pass
it down instead of assuming symbol_name_match_type::FULL.
* block.h (block_lookup_symbol): New parameter 'match_type'.
* c-valprint.c (print_unpacked_pointer): Use
lookup_symbol_search_name instead of lookup_symbol.
* compile/compile-object-load.c (get_out_value_type): Pass down
symbol_name_match_type::SEARCH_NAME.
* cp-namespace.c (cp_basic_lookup_symbol): Pass down
symbol_name_match_type::FULL.
* cp-support.c (cp_get_symbol_name_matcher): Handle
symbol_name_match_type::SEARCH_NAME.
* infrun.c (insert_exception_resume_breakpoint): Use
lookup_symbol_search_name.
* p-valprint.c (pascal_val_print): Use lookup_symbol_search_name.
* psymtab.c (maintenance_check_psymtabs): Use
symbol_name_match_type::SEARCH_NAME and SYMBOL_SEARCH_NAME.
* stack.c (print_frame_args): Use lookup_symbol_search_name and
SYMBOL_SEARCH_NAME.
* symtab.c (lookup_local_symbol): Don't demangle the lookup name
if symbol_name_match_type::SEARCH_NAME.
(lookup_symbol_in_language): Pass down
symbol_name_match_type::FULL.
(lookup_symbol_search_name): New.
(lookup_language_this): Pass down
symbol_name_match_type::SEARCH_NAME.
(lookup_symbol_aux, lookup_local_symbol): New parameter
'match_type'. Pass it down.
* symtab.h (symbol_name_match_type::SEARCH_NAME): New enumerator.
(lookup_symbol_search_name): New declaration.
(lookup_symbol_in_block): New 'match_type' parameter.
2018-01-05 Pedro Alves <palves@redhat.com>
PR gdb/22670
* ada-lang.c (ada_lookup_encoded_symbol): Reimplement in terms of
ada_lookup_symbol.
(ada_lookup_symbol): Reimplement in terms of
ada_lookup_symbol_list, bits factored out from
ada_lookup_encoded_symbol.
(Ada) problem printing renaming which references a subprogram parameter Consider the following code, which creates a local variable B which is a renaming whose expression references a subprogram parameter: procedure Flip (Bits : in out Bits_Type; I : Natural) is begin declare B : Boolean renames Bits (I); begin B := not B; -- BREAK end; end Flip; Trying to print the value of B when at the "BREAK" line currently does not work: (gdb) p b Could not find i What happens is the following: For the renaming, GNAT generates a variable whose name is encoded as follow: b___XR_bits___XEXSi GDB properly detects that variable, determines that, to compute the variable's value, we start from the symbol "Bits", which we then have to subscript (XS) using 'i' as the index. The error occurs while trying to find 'i'. This is because we forgot to pass the block in the call to ada_lookup_encoded_symbol, which this patch fixes. gdb/ChangeLog: * ada-exp.y (write_object_renaming): When subscripting an array using a symbol as the index, pass the block in call to ada_lookup_encoded_symbol when looking that symbol up. gdb/testsuite/ChangeLog: * gdb.ada/rename_subscript_param: New testcase. Tested on x86_64-linux. Note: This requires the following GCC patch: | 2017-04-25 Pierre-Marie de Rodat <derodat@adacore.com> | | * exp_dbug.adb: In Debug_Renaming_Declaration, | when dealing with indexed component, accept to produce a renaming | symbol when the index is an IN parameter or when it is a name | defined in an outer scope.
2018-01-05 10:29:54 +01:00
2018-01-05 Joel Brobecker <brobecker@adacore.com>
* ada-exp.y (write_object_renaming): When subscripting an array
using a symbol as the index, pass the block in call to
ada_lookup_encoded_symbol when looking that symbol up.
2018-01-05 Jerome Guitton <guitton@adacore.com>
* ada-lang.c (ada_array_length): Use ada_index_type instead of
TYPE_INDEX_TYPE.
memory error printing component of record from convenience variable Consider the following situation Ada code: type Kind_T is (One, Two, Three); type Time_Set_T is array (Kind_T) of Integer; type T is record Started : Time_Set_T; end record; Null_T : constant T := (Started => (others => 0)); My_Item : Pck.T := Pck.Null_T; Trying to print the value of My_Item.Started is no problem: (gdb) p item.started $1 = (0, 0, 0) However, if you save My_Item into a convenience variable first, and then try to print a component of that record, you get an unexpected memory error, instead of getting the same result. For instance: (gdb) set variable $item := item (gdb) p $item.started Cannot access memory at address 0x0 The issue occurs when, after we extracted the component from the convenience variable, we next try to "fix" it (which is ada-lang speak for resolving the type into a static type). This is done in ada_to_fixed_value, which delegates to ada_to_fixed_value_create via: val = ada_to_fixed_value_create (value_type (val), value_address (val), val); And looking at ada_to_fixed_value_create, we see that: struct type *type = ada_to_fixed_type (type0, 0, address, NULL, 1); if (type == type0 && val0 != NULL) return val0; else return value_from_contents_and_address (type, 0, address); The part that interests us, in this case, is the "else" branch, where we obviously make the implicit assumption that our object has an address, which is not true, in this case, because we are actually dealing with a convenience variable. This patch plugs that hole by adding special handing for situations where val does not live in memory. In that case, we just create a not_lval value using val's contents. gdb/ChangeLog: * ada-lang.c (ada_to_fixed_value_create): Add handling of the case where VALUE_LVAL (val0) is not lval_memory. gdb/testsuite/ChangeLog: * gdb.ada/convvar_comp: New testcase. Tested on x86_64-linux.
2018-01-05 08:37:38 +01:00
2018-01-05 Joel Brobecker <brobecker@adacore.com>
* ada-lang.c (ada_to_fixed_value_create): Add handling of
the case where VALUE_LVAL (val0) is not lval_memory.
2018-01-05 08:39:10 +01:00
2018-01-05 Xavier Roirand <roirand@adacore.com>
* ada-valprint.c (print_optional_low_bound): Handle
character-indexed array printing like boolean-indexed array
printing.
2018-01-05 Joel Brobecker <brobecker@adacore.com>
* NEWS: Create a new section for the next release branch.
Rename the section of the current branch, now that it has
been cut.
2018-01-05 Joel Brobecker <brobecker@adacore.com>
GDB 8.1 branch created (5219ac6237c272b938c28517bf371429260c71e7):
* version.in: Bump version to 8.1.50.DATE-git.
(Ada) New command to stop at start of exception handler. When using gdb for debugging Ada source code, there are several catchpoint types you can define in order to stop upon certain conditions. Let's use this small example: procedure Foo is begin begin raise Constraint_Error; exception when Program_Error => null; when Constraint_Error => null; when others => null; end; end Foo; One can stop when the exception is being raised by using the exception catchpoint like below: (gdb) catch exception Catchpoint 1: all Ada exceptions (gdb) In that case, when running Foo, gdb will stop at the line where the exception was raised: begin >>> raise Constraint_Error; exception This patch introduces new type of catchpoint, when the user wants to stop at the location of the exception handling. Imagine we want to stop on any exception handled by the program, we can do: (gdb) catch handlers Catchpoint 1: all Ada exceptions handlers (gdb) r Starting program: /tmp/foo By doing so, when running Foo, gdb will stop here: Catchpoint 1, exception at 0x000000000040255a in foo () at foo.adb:25 25 when Constraint_Error => (gdb) It is also possible to stop when the Constraint_Error exception is being handled in this program. With this patch, we can use: (gdb) catch handlers Constraint_Error Catchpoint 1: `Constraint_Error' Ada exception handlers (gdb) Like for other catchpoint, you can set a condition when adding a catchpoint on exception handlers. Here the handlers catchpoint checks Global_Var: (gdb) catch handlers Constraint_Error if Global_Var /= 0 gdb/ChangeLog: * ada-lang.h (ada_exception_catchpoint_kind) <ada_catch_handlers>: Add field. * ada-lang.c (struct exception_support_info) <catch_handlers_sym>: Add field. (default_exception_support_info) <catch_handlers_sym>: Add field. (exception_support_info_fallback) <catch_handlers_sym>: Add field. (ada_exception_name_addr_1): Add "catch handlers" handling. (ada_exception_catchpoint_cond_string) <ex>: New parameter. Update all callers. (create_excep_cond_exprs) <ex>: Add parameter. (re_set_exception): Update create_excep_cond_exprs call. (print_it_exception, print_one_exception, print_mention_exception) (print_recreate_exception): Add "catch handler" handling. (allocate_location_catch_handlers, re_set_catch_handlers) (check_status_catch_handlers, print_it_catch_handlers) (print_one_catch_handlers, print_mention_catch_handlers) (print_recreate_catch_handlers): New function. (catch_handlers_breakpoint_ops): New variable. (catch_ada_exception_command_split) <is_catch_handlers_cmd>: Add parameter. Add "catch handler" handling. (ada_exception_sym_name, ada_exception_breakpoint_ops): Add "catch handler" handling. (ada_exception_catchpoint_cond_string): Add "catch handler" handling. (create_ada_exception_catchpoint): Update create_excep_cond_exprs call. (catch_ada_handlers_command): New function. (initialize_ada_catchpoint_ops): Initialize "catch handlers" operations structure. (_initialize_ada_language): Add "catch handlers" command entry. * NEWS: Document "catch handlers" feature. gdb/doc/ChangeLog: * gdb.texinfo (Set Catchpoints): Add documentation for new "catch handlers" action. gdb/testsuite/ChangeLog: * gdb.ada/excep_handle.exp: New testcase. * gdb.ada/excep_handle/foo.adb: New file. * gdb.ada/excep_handle/pck.ads: New file. Tested on x86_64-linux.
2017-11-22 10:40:39 +01:00
2018-01-03 Xavier Roirand <roirand@adacore.com>
* ada-lang.h (ada_exception_catchpoint_kind) <ada_catch_handlers>:
Add field.
* ada-lang.c (struct exception_support_info) <catch_handlers_sym>:
Add field.
(default_exception_support_info) <catch_handlers_sym>: Add field.
(exception_support_info_fallback) <catch_handlers_sym>: Add field.
(ada_exception_name_addr_1): Add "catch handlers" handling.
(ada_exception_catchpoint_cond_string) <ex>: New parameter.
Update all callers.
(create_excep_cond_exprs) <ex>: Add parameter.
(re_set_exception): Update create_excep_cond_exprs call.
(print_it_exception, print_one_exception, print_mention_exception)
(print_recreate_exception): Add "catch handler" handling.
(allocate_location_catch_handlers, re_set_catch_handlers)
(check_status_catch_handlers, print_it_catch_handlers)
(print_one_catch_handlers, print_mention_catch_handlers)
(print_recreate_catch_handlers): New function.
(catch_handlers_breakpoint_ops): New variable.
(catch_ada_exception_command_split) <is_catch_handlers_cmd>:
Add parameter. Add "catch handler" handling.
(ada_exception_sym_name, ada_exception_breakpoint_ops):
Add "catch handler" handling.
(ada_exception_catchpoint_cond_string): Add "catch handler"
handling.
(create_ada_exception_catchpoint): Update create_excep_cond_exprs
call.
(catch_ada_handlers_command): New function.
(initialize_ada_catchpoint_ops): Initialize "catch handlers"
operations structure.
(_initialize_ada_language): Add "catch handlers" command entry.
* NEWS: Document "catch handlers" feature.
[gdb/Ada] slices of arrays with dynamic strides Consider the following Ada code: procedure Nested (L, U : Integer) is subtype Small_Type is Integer range L .. U; type Record_Type (I : Small_Type := L) is record S : String (1 .. I); end record; type Array_Type is array (Integer range <>) of Record_Type; A1 : Array_Type := (1 => (I => 0, S => <>), 2 => (I => 1, S => "A"), 3 => (I => 2, S => "AB")); procedure Discard (R : Record_Type) is begin null; end Discard; begin Discard (A1 (1)); -- STOP end; Trying to print a slice of that array currently yields: (gdb) p a1(1..3) $1 = ((i => 0, s => ""), (i => 0, s => ""), (i => 0, s => "")) We expected instead: (gdb) p a1(1..3) $1 = ((i => 0, s => ""), (i => 1, s => "A"), (i => 2, s => "AB")) This is because the functions we use in ada-lang.c to create the type of the array slice (ada_value_slice and ada_value_slice_from_ptr) was not taking into account the stride of the array. This patch fixes this. gdb/ChangeLog: * ada-lang.c (ada_value_slice_from_ptr): Take array stride into account when creating the array type of the slice. (ada_value_slice): Likewise. gdb/testsuite/ChangeLog: * gdb.ada/dyn_stride.exp: Add slice test. Note that, with the current use of ada_value_slice, the enhancement to handle dynamic array strides seems unnecessary, because I do not see how an array with a dynamic stride can be referenced by either by reference or pointer. Since references are coerced to array pointers, in both cases, the slice is performed by ada_value_slice_from_ptr. But ada_value_slice is enhanced nonetheless, in the spirit of making the code more robust, in case we missed something, and also as similar as possible with its from_ptr counterpart. tested on x86_64-linux.
2018-01-02 04:53:55 +01:00
2018-01-02 Joel Brobecker <brobecker@adacore.com>
* ada-lang.c (ada_value_slice_from_ptr): Take array stride into
account when creating the array type of the slice.
(ada_value_slice): Likewise.
Add support for dynamic DW_AT_byte_stride. This patch adds support for DW_AT_byte_stride, using Ada as one example of where this would be useful. However, the implementation is language-agnostic. Consider the following Ada code: procedure Nested (L, U : Integer) is subtype Small_Type is Integer range L .. U; type Record_Type (I : Small_Type := L) is record S : String (1 .. I); end record; type Array_Type is array (Integer range <>) of Record_Type; A1 : Array_Type := (1 => (I => 0, S => <>), 2 => (I => 1, S => "A"), 3 => (I => 2, S => "AB")); procedure Discard (R : Record_Type) is begin null; end Discard; begin Discard (A1 (1)); -- STOP end; It defines an array A1 of Record_Type, which is a variant record type whose maximum size actually depends on the value of the parameters passed when calling Nested. As a result, the stride of the array A1 cannot be known statically, which leads the compiler to generate a dynamic DW_AT_byte_stride attribute for our type. Here is what the debugging info looks like with GNAT: .uleb128 0x10 # (DIE (0x14e) DW_TAG_array_type) .long .LASF17 # DW_AT_name: "foo__nested__T18b" .long 0x141 # DW_AT_byte_stride .long 0xdc # DW_AT_type .uleb128 0x11 # (DIE (0x15f) DW_TAG_subrange_type) .long 0x166 # DW_AT_type .byte 0x3 # DW_AT_upper_bound .byte 0 # end of children of DIE 0x14e There DW_AT_byte_stride is a reference to a local (internal) variable: .uleb128 0x9 # (DIE (0x141) DW_TAG_variable) .long .LASF6 # DW_AT_name: "foo__nested__T18b___PAD___XVZ" This patch enhances GDB to handle this dynamic byte stride attribute by first adding a new dynamic_prop_node_kind (DYN_PROP_BYTE_STRIDE) to store the array dynamic stride info (when dynamic). It then enhances the dynamic type resolver to handle this dynamic property. Before applying this patch, trying to print the value of some of A1's elements after having stopped at the "STOP" comment does not work. For instance: (gdb) p a1(2) Cannot access memory at address 0x80000268dec0 With this patch applied, GDB now prints the value of all 3 elements correctly: (gdb) print A1(1) $1 = (i => 0, s => "") (gdb) print A1(2) $2 = (i => 1, s => "A") (gdb) print A1(3) $3 = (i => 2, s => "AB") gdb/ChangeLog: * gdbtypes.h (enum dynamic_prop_node_kind) <DYN_PROP_BYTE_STRIDE>: New enum value. (create_array_type_with_stride): Add byte_stride_prop parameter. * gdbtypes.c (create_array_type_with_stride) <byte_stride_prop>: New parameter. Update all callers in this file. (array_type_has_dynamic_stride): New function. (is_dynamic_type_internal, resolve_dynamic_array): Add handling of arrays with dynamic byte strides. * dwarf2read.c (read_array_type): Add support for dynamic DW_AT_byte_stride attributes. gdb/testsuite/ChangeLog: * gdb.ada/dyn_stride: New testcase. Tested on x86_64-linux.
2018-01-02 04:47:18 +01:00
2018-01-02 Joel Brobecker <brobecker@adacore.com>
* gdbtypes.h (enum dynamic_prop_node_kind) <DYN_PROP_BYTE_STRIDE>:
New enum value.
(create_array_type_with_stride): Add byte_stride_prop parameter.
* gdbtypes.c (create_array_type_with_stride) <byte_stride_prop>:
New parameter. Update all callers in this file.
(array_type_has_dynamic_stride): New function.
(is_dynamic_type_internal, resolve_dynamic_array): Add handling
of arrays with dynamic byte strides.
* dwarf2read.c (read_array_type): Add support for dynamic
DW_AT_byte_stride attributes.
2018-01-02 Joel Brobecker <brobecker@adacore.com>
* dwarf2read.c (read_unspecified_type): Treat
DW_TAG_enumeration_type DIEs from Ada units as stubs.
2018-01-01 Joel Brobecker <brobecker@adacore.com>
Update copyright year range in all GDB files.
2018-01-01 Joel Brobecker <brobecker@adacore.com>
* copyright.py (BY_HAND): Remove gdb/testsuite/gdb.base/step-line.inp
and gdb/testsuite/gdb.base/step-line.c.
2018-01-01 Joel Brobecker <brobecker@adacore.com>
* copyright.py (main): Dump the contents of
MULTIPLE_COPYRIGHT_HEADERS (separately) from BY_HAND,
even if BY_HAND is empty.
2018-01-01 Joel Brobecker <brobecker@adacore.com>
* top.c (print_gdb_version): Update Copyright year in version
message.
2018-01-01 Joel Brobecker <brobecker@adacore.com>
* config/djgpp/fnchange.lst: Add entry for gdb/ChangeLog-2017.
For older changes see ChangeLog-2017.
Local Variables:
mode: change-log
left-margin: 8
fill-column: 74
version-control: never
2007-08-10 00:44:38 +02:00
coding: utf-8
End: