aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-04-08Share handle_load_dll and handle_unload_dll declarationsTom Tromey5-33/+45
This changes nat/windows-nat.h to declare handle_load_dll and handle_unload_dll. The embedding application is required to implement these -- while the actual code was difficult to share due to some other differences between the two programs, sharing the declaration lets a subsequent patch share more code that uses these as callbacks. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (windows_nat::handle_load_dll) (windows_nat::handle_unload_dll): Rename. No longer static. * nat/windows-nat.h (handle_load_dll, handle_unload_dll): Declare. gdbserver/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * win32-low.c (windows_nat::handle_load_dll): Rename from handle_load_dll. No longer static. (windows_nat::handle_unload_dll): Rename from handle_unload_dll. No longer static.
2020-04-08Fix up complaints.h for namespace useTom Tromey2-2/+9
If 'complaint' is used in a namespace context, it will fail because 'stop_whining' is only declared at the top level. This patch fixes this problem in a simple way, by moving the declaration of 'stop_whining' out of the macro and to the top-level. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * complaints.h (stop_whining): Declare at top-level. (complaint): Don't declare stop_whining.
2020-04-08Normalize handle_output_debug_string APITom Tromey5-14/+39
This changes gdbserver's implementation of handle_output_debug_string to have the same calling convention as that of gdb. This allows for sharing some more code in a subsequent patch. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (windows_nat::handle_output_debug_string): Rename. No longer static. * nat/windows-nat.h (handle_output_debug_string): Declare. gdbserver/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * win32-low.c (handle_output_debug_string): Add parameter. Change return type. (win32_kill, get_child_debug_event): Update.
2020-04-08Share some Windows-related globalsTom Tromey6-96/+130
This moves some Windows-related globals into nat/windows-nat.c, sharing them between gdb and gdbserver. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (current_process_handle, current_process_id) (main_thread_id, last_sig, current_event, last_wait_event) (current_windows_thread, desired_stop_thread_id, pending_stops) (struct pending_stop, siginfo_er): Move to nat/windows-nat.c. (display_selectors, fake_create_process) (get_windows_debug_event): Update. * nat/windows-nat.h (current_process_handle, current_process_id) (main_thread_id, last_sig, current_event, last_wait_event) (current_windows_thread, desired_stop_thread_id, pending_stops) (struct pending_stop, siginfo_er): Move from windows-nat.c. * nat/windows-nat.c (current_process_handle, current_process_id) (main_thread_id, last_sig, current_event, last_wait_event) (current_windows_thread, desired_stop_thread_id, pending_stops) (siginfo_er): New globals. Move from windows-nat.c. gdbserver/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * win32-low.c (current_process_handle, current_process_id) (main_thread_id, last_sig, current_event, siginfo_er): Move to nat/windows-nat.c.
2020-04-08Share get_image_name between gdb and gdbserverTom Tromey6-101/+77
This moves get_image_name to nat/windows-nat.c so that it can be shared between gdb and gdbserver. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (get_image_name): Move to nat/windows-nat.c. (handle_load_dll): Update. * nat/windows-nat.c (get_image_name): Move from windows-nat.c. gdbserver/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * win32-low.c (get_image_name): Remove. (handle_load_dll): Update.
2020-04-08Share thread_rec between gdb and gdbserverTom Tromey5-49/+79
This changes gdb and gdbserver to use the same calling convention for the "thread_rec" helper function. Fully merging these is difficult due to differences in how threads are managed by the enclosing applications; but sharing a declaration makes it possible for future shared code to call this method. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (enum thread_disposition_type): Move to nat/windows-nat.h. (windows_nat::thread_rec): Rename from thread_rec. No longer static. (windows_add_thread, windows_nat_target::fetch_registers) (windows_nat_target::store_registers, handle_exception) (windows_nat_target::resume, get_windows_debug_event) (windows_nat_target::get_tib_address) (windows_nat_target::thread_name) (windows_nat_target::thread_alive): Update. * nat/windows-nat.h (enum thread_disposition_type): Move from windows-nat.c. (thread_rec): Declare. gdbserver/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * win32-low.c (windows_nat::thread_rec): Rename from thread_rec. No longer static. Change parameters. (child_add_thread, child_fetch_inferior_registers) (child_store_inferior_registers, win32_resume) (win32_get_tib_address): Update.
2020-04-08Wrap shared windows-nat code in windows_nat namespaceTom Tromey9-7/+41
This wraps the shared windows-nat code in a windows_nat namespace. This helps avoid name clashes. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c: Add "using namespace". * nat/windows-nat.h: Wrap contents in windows_nat namespace. * nat/windows-nat.c: Wrap contents in windows_nat namespace. gdbserver/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * win32-low.h (struct win32_target_ops): Use qualified names where needed. * win32-i386-low.c: Add "using namespace". * win32-low.c: Add "using namespace". * win32-arm-low.c: Add "using namespace".
2020-04-08Call CloseHandle from ~windows_thread_infoTom Tromey5-1/+17
Add a destructor to windows_thread_info that calls CloseHandle. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * nat/windows-nat.h (struct windows_thread_info): Declare destructor. * nat/windows-nat.c (~windows_thread_info): New. gdbserver/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * win32-low.c (delete_thread_info): Don't call CloseHandle.
2020-04-08Handle pending stops from the Windows kernelTom Tromey4-13/+215
PR gdb/22992 concerns an assertion failure in gdb when debugging a certain inferior: int finish_step_over(execution_control_state*): Assertion `ecs->event_thread->control.trap_expected' failed. Initially the investigation centered on the discovery that gdb was not suspending other threads when attempting to single-step. This oversight is corrected in this patch: now, when stepping a thread, gdb will call SuspendThread on all other threads. However, the bug persisted even after this change. In particular, WaitForDebugEvent could see a stop for a thread that was ostensibly suspended. Our theory of what is happening here is that there are actually simultaneous breakpoint hits, and the Windows kernel queues the events, causing the second stop to be reported on a suspended thread. In Windows 10 or later gdb could use the DBG_REPLY_LATER flag to ContinueDebugEvent to request that such events be re-reported later. However, relying on that did not seem advisable, so this patch instead arranges to queue such "pending" stops, and then to report them later, once the step has completed. In the PR, Pedro pointed out that it's best in this scenario to implement the stopped_by_sw_breakpoint method, so this patch does this as well. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> PR gdb/22992 * windows-nat.c (current_event): Update comment. (last_wait_event, desired_stop_thread_id): New globals. (struct pending_stop): New. (pending_stops): New global. (windows_nat_target) <stopped_by_sw_breakpoint> <supports_stopped_by_sw_breakpoint>: New methods. (windows_fetch_one_register): Add assertions. Adjust PC. (windows_continue): Handle pending stops. Suspend other threads when stepping. Use last_wait_event (wait_for_debug_event): New function. (get_windows_debug_event): Use wait_for_debug_event. Handle pending stops. Queue spurious stops. (windows_nat_target::wait): Set stopped_at_software_breakpoint. (windows_nat_target::kill): Use wait_for_debug_event. * nat/windows-nat.h (struct windows_thread_info) <stopped_at_software_breakpoint>: New field. * nat/windows-nat.c (windows_thread_info::resume): Clear stopped_at_software_breakpoint.
2020-04-08Change type of argument to windows-nat.c:thread_recTom Tromey2-20/+55
windows-nat.c:thread_rec accepts an integer parameter whose interpretation depends on whether it is less than, equal to, or greater than zero. I found this confusing at times, so this patch replaces it with an enum instead. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (enum thread_disposition_type): New. (thread_rec): Replace "get_context" parameter with "disposition"; change type. (windows_add_thread, windows_nat_target::fetch_registers) (windows_nat_target::store_registers, handle_exception) (windows_nat_target::resume, get_windows_debug_event) (windows_nat_target::get_tib_address) (windows_nat_target::thread_name) (windows_nat_target::thread_alive): Update.
2020-04-08Share Windows thread-suspend and -resume codeTom Tromey8-57/+95
This adds "suspend" and "resume" methods to windows_thread_info, and changes gdb and gdbserver to share this code. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (thread_rec): Use windows_thread_info::suspend. (windows_continue): Use windows_continue::resume. * nat/windows-nat.h (struct windows_thread_info) <suspend, resume>: Declare new methods. * nat/windows-nat.c: New file. * configure.nat (NATDEPFILES): Add nat/windows-nat.o when needed. gdbserver/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * win32-low.c (win32_require_context, suspend_one_thread): Use windows_thread_info::suspend. (continue_one_thread): Use windows_thread_info::resume. * configure.srv (srv_tgtobj): Add windows-nat.o when needed.
2020-04-08Use lwp, not tid, for Windows thread idTom Tromey2-27/+40
This changes windows-nat.c to put the Windows thread id into the "lwp" field of ptid_t, not the "tid" field. This is done for two reasons. First, ptid.h has this to say: process_stratum targets that handle threading themselves should prefer using the ptid.lwp field, leaving the ptid.tid field for any thread_stratum target that might want to sit on top. Second, this change brings gdb and gdbserver into sync here, which makes sharing code simpler. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (windows_add_thread, windows_delete_thread) (windows_nat_target::fetch_registers) (windows_nat_target::store_registers, fake_create_process) (windows_nat_target::resume, windows_nat_target::resume) (get_windows_debug_event, windows_nat_target::wait) (windows_nat_target::pid_to_str) (windows_nat_target::get_tib_address) (windows_nat_target::get_ada_task_ptid) (windows_nat_target::thread_name) (windows_nat_target::thread_alive): Use lwp, not tid.
2020-04-08Make windows_thread_info::name a unique_xmalloc_ptrTom Tromey3-9/+10
This changes windows_thread_info::name to be a unique_xmalloc_ptr, removing some manual memory management. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (handle_exception) (windows_nat_target::thread_name): Update. * nat/windows-nat.h (windows_thread_info): Remove destructor. <name>: Now unique_xmalloc_ptr.
2020-04-08Change two windows_thread_info members to "bool"Tom Tromey5-8/+24
This changes a couple of fields of windows_thread_info to have type "bool". It also updates the comment of another field, to clarify the possible values it can hold. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (thread_rec) (windows_nat_target::fetch_registers): Update. * nat/windows-nat.h (struct windows_thread_info) <suspended>: Update comment. <debug_registers_changed, reload_context>: Now bool. gdbserver/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * win32-i386-low.c (update_debug_registers) (i386_prepare_to_resume, i386_thread_added): Update.
2020-04-08Use new and delete for windows_thread_infoTom Tromey5-20/+41
This adds a constructor, destructor, and member initializers to windows_thread_info, and changes gdb and gdbserver to use new and delete. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (windows_add_thread): Use new. (windows_init_thread_list, windows_delete_thread): Use delete. (get_windows_debug_event): Update. * nat/windows-nat.h (struct windows_thread_info): Add constructor, destructor, and initializers. gdbserver/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * win32-low.c (child_add_thread): Use new. (delete_thread_info): Use delete.
2020-04-08Share windows_thread_info between gdb and gdbserverTom Tromey5-48/+77
This introduces a new file, nat/windows-nat.h, which holds the definition of windows_thread_info. This is now shared between gdb and gdbserver. Note that the two implementations different slightly. gdb had a couple of fields ("name" and "reload_context") that gdbserver did not; while gdbserver had one field ("base_context") that gdb did not, plus better comments. The new file preserves all the fields, and the comments. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (struct windows_thread_info): Remove. * nat/windows-nat.h: New file. gdbserver/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * win32-low.h (struct windows_thread_info): Remove.
2020-04-08Rename windows_thread_info::id to "tid"Tom Tromey2-5/+11
This changes the name of a field in windows_thread_info, bringing gdb and gdbserver closer into sync. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (struct windows_thread_info) <tid>: Rename from "id". (thread_rec, windows_add_thread, windows_delete_thread) (windows_continue): Update.
2020-04-08Rename win32_thread_info to windows_thread_infoTom Tromey5-37/+58
This renames win32_thread_info to windows_thread_info in gdbserver. This renaming helps make it possible to share some code between gdb and gdbserver. gdbserver/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * win32-low.h (struct windows_thread_info): Rename from win32_thread_info. Remove typedef. (struct win32_target_ops, win32_require_context): Update. * win32-low.c (win32_get_thread_context) (win32_set_thread_context, win32_prepare_to_resume) (win32_require_context, thread_rec, child_add_thread) (delete_thread_info, continue_one_thread) (child_fetch_inferior_registers, child_store_inferior_registers) (win32_resume, suspend_one_thread, win32_get_tib_address): Update. * win32-i386-low.c (update_debug_registers) (win32_get_current_dr, i386_get_thread_context) (i386_prepare_to_resume, i386_thread_added, i386_single_step) (i386_fetch_inferior_register, i386_store_inferior_register): Update. * win32-arm-low.c (arm_get_thread_context) (arm_fetch_inferior_register, arm_store_inferior_register): Update.
2020-04-08Remove the "next" field from windows_thread_infoTom Tromey2-31/+29
This changes windows_thread_info to remove the "next" field, replacing the linked list of threads with a vector. This is a prerequisite to sharing this structure with gdbserver, which manages threads differently. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (struct windows_thread_info): Remove typedef. (thread_head): Remove. (thread_list): New global. (thread_rec, windows_add_thread, windows_init_thread_list) (windows_delete_thread, windows_continue): Update.
2020-04-08gdb: stop using host-dependent signal numbers in windows-tdep.cSimon Marchi5-79/+205
The signal enumeration in windows-tdep.c is defined differently whether it is compiled on Cygwin or not. This is problematic, since the code in tdep files is not supposed to be influenced by the host platform (the platform GDB itself runs on). This makes a difference in windows_gdb_signal_to_target. An obvious example of clash is SIGABRT. Let's pretend we are cross-debugging a Cygwin process from a MinGW (non-Cygwin Windows) GDB. If GDB needs to translate the gdb signal number GDB_SIGNAL_ABRT into a target equivalent, it would obtain the MinGW number (22), despite the target being a Cygwin process. Conversely, if debugging a MinGW process from a Cygwin-hosted GDB, GDB_SIGNAL_ABRT would be converted to a Cygwin signal number (6) despite the target being a MinGW process. This is wrong, since we want the result to depend on the target's platform, not GDB's platform. This known flaw was accepted because at the time we had a single OS ABI (called Cygwin) for all Windows binaries (Cygwin ones and non-Cygwin ones). This limitation is now lifted, as we now have separate Windows and Cygwin OS ABIs. This means we are able to detect at runtime whether the binary we are debugging is a Cygwin one or non-Cygwin one. This patch splits the signal enum in two, one for the MinGW flavors and one for Cygwin, removing all the ifdefs that made it depend on the host platform. It then makes two separate gdb_signal_to_target gdbarch methods, that are used according to the OS ABI selected at runtime. There is a bit of re-shuffling needed in how the gdbarch'es are initialized, but nothing major. gdb/ChangeLog: * windows-tdep.h (windows_init_abi): Add comment. (cygwin_init_abi): New declaration. * windows-tdep.c: Split signal enumeration in two, one for Windows and one for Cygwin. (windows_gdb_signal_to_target): Only deal with signal of the Windows OS ABI. (cygwin_gdb_signal_to_target): New function. (windows_init_abi): Rename to windows_init_abi_common, don't set gdb_signal_to_target gdbarch method. Add new new function with this name. (cygwin_init_abi): New function. * amd64-windows-tdep.c (amd64_windows_init_abi_common): Add comment. Don't call windows_init_abi. (amd64_windows_init_abi): Add comment, call windows_init_abi. (amd64_cygwin_init_abi): Add comment, call cygwin_init_abi. * i386-windows-tdep.c (i386_windows_init_abi): Rename to i386_windows_init_abi_common, don't call windows_init_abi. Add a new function of this name. (i386_cygwin_init_abi): New function. (_initialize_i386_windows_tdep): Bind i386_cygwin_init_abi to OS ABI Cygwin.
2020-04-08Remove objfile parameter from read_gdb_index_from_bufferSimon Marchi2-5/+9
I noticed this was unused, so remove it. gdb/ChangeLog: * dwarf2/read.c (read_gdb_index_from_buffer): Remove objfile parameter.c. (dwarf2_read_gdb_index): Update.
2020-04-08[PATCH 1/4]: microblaze: remove duplicate prototypesGunther Nikl2-15/+4
The microblaze target header duplicates prototypes already provided by tc.h. * config/tc-microblaze.h (md_begin, md_assemble, md_undefined_symbol, md_show_usage, md_convert_frag, md_operand, md_number_to_chars, md_estimate_size_before_relax, md_section_align, tc_gen_reloc, md_apply_fix3): Delete prototypes.
2020-04-08[PATCH 4/4]: Add generic prototype for md_pcrel_from_sectionGunther Nikl33-34/+39
This patch removes the need for target headers to provide a custom prototype for md_pcrel_from_section. * tc.h (md_pcrel_from_section): Add prototype. * config/tc-aarch64.h (md_pcrel_from_section): Remove prototype. * config/tc-arc.h (md_pcrel_from_section): Likewise. * config/tc-arm.h (md_pcrel_from_section): Likewise. * config/tc-avr.h (md_pcrel_from_section): Likewise. * config/tc-bfin.h (md_pcrel_from_section): Likewise. * config/tc-bpf.h (md_pcrel_from_section): Likewise. * config/tc-csky.h (md_pcrel_from_section): Likewise. * config/tc-d10v.h (md_pcrel_from_section): Likewise. * config/tc-d30v.h (md_pcrel_from_section): Likewise. * config/tc-epiphany.h (md_pcrel_from_section): Likewise. * config/tc-fr30.h (md_pcrel_from_section): Likewise. * config/tc-frv.h (md_pcrel_from_section): Likewise. * config/tc-iq2000.h (md_pcrel_from_section): Likewise. * config/tc-lm32.h (md_pcrel_from_section): Likewise. * config/tc-m32c.h (md_pcrel_from_section): Likewise. * config/tc-m32r.h (md_pcrel_from_section): Likewise. * config/tc-mcore.h (md_pcrel_from_section): Likewise. * config/tc-mep.h (md_pcrel_from_section): Likewise. * config/tc-metag.h (md_pcrel_from_section): Likewise. * config/tc-microblaze.h (md_pcrel_from_section): Likewise. * config/tc-mmix.h (md_pcrel_from_section): Likewise. * config/tc-moxie.h (md_pcrel_from_section): Likewise. * config/tc-msp430.h (md_pcrel_from_section): Likewise. * config/tc-mt.h (md_pcrel_from_section): Likewise. * config/tc-or1k.h (md_pcrel_from_section): Likewise. * config/tc-ppc.h (md_pcrel_from_section): Likewise. * config/tc-rl78.h (md_pcrel_from_section): Likewise. * config/tc-rx.h (md_pcrel_from_section): Likewise. * config/tc-s390.h (md_pcrel_from_section): Likewise. * config/tc-sh.h (md_pcrel_from_section): Likewise. * config/tc-xc16x.h (md_pcrel_from_section): Likewise. * config/tc-xstormy16.h (md_pcrel_from_section): Likewise.
2020-04-08[PATCH 3/4]: m32c: remove duplicate define and prototypeGunther Nikl2-4/+3
The m32c target header has a duplicate entry for MD_PCREL_FROM_SECTION. The duplication was present since the initial commit of the port. * config/tc-m32c.h (MD_PCREL_FROM_SECTION): Delete duplicate define. (md_pcrel_from_section): Remove duplicate prototype.
2020-04-08[PATCH 2/4]: moxie: use generic pcrel supportGunther Nikl2-8/+5
The moxie target header uses md_pcrel_from, thus the local prototype and the macro definition for MD_PCREL_FROM_SECTION are not needed. * config/tc-moxie.h (MD_PCREL_FROM_SECTION): Delete define. (md_pcrel_from): Remove prototytpe.
2020-04-08[gdb/testsuite] Fix imported-unit.exp FAIL without psymtabsTom de Vries3-10/+40
The test-case gdb.dwarf2/imported-unit.exp contains a test testing partial symbols, so when we run the test-case using either target board readnow, cc-with-gdb-index or cc-with-debug-names, we run into: ... FAIL: gdb.dwarf2/imported-unit.exp: no static partial symbols in importing unit ... Fix this by marking the test unsupported if there are no partial symbols. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-04-08 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (psymtabs_p): New proc. * gdb.dwarf2/imported-unit.exp: Mark "no static partial symbols in importing unit" unsupported if there are no partial symbols.
2020-04-08[gdb/testsuite] Add gcc/94469 xfails to gdb.ada/call_pn.expTom de Vries2-3/+52
When running test-case gdb.ada/call_pn.exp with target board unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects, we run into: ... (gdb) print last_node_id^M Multiple matches for last_node_id^M [0] cancel^M [1] pck.last_node_id at gdb/testsuite/gdb.ada/call_pn/pck.adb:17^M [2] pck.last_node_id at gdb/testsuite/gdb.ada/call_pn/foo.adb:17^M > FAIL: gdb.ada/call_pn.exp: print last_node_id after calling pn (timeout) ... This failure is due to a gcc bug that declares two instead of one symbols, filed as PR gcc/94469. Add an xfail at this test. Also add a similar xfail at an earlier test, that only triggers with -readnow. Stabilize test results by making sure the earlier xfail is always triggered, using "maint expand-symtabs". Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-04-08 Tom de Vries <tdevries@suse.de> PR testsuite/25760 * gdb.ada/call_pn.exp: Call "maint expand-symtabs". Add xfails.
2020-04-08Automatic date update in version.inGDB Administrator1-1/+1
2020-04-07Define NetBSD specific skip_solib_resolverKamil Rytarowski2-0/+22
gdb/ChangeLog: * nbsd-tdep.c: Include "objfiles.h". (nbsd_skip_solib_resolver): New. (nbsd_init_abi): Call set_gdbarch_skip_solib_resolver().
2020-04-07DWARFv5: Info address command error in gdb with DWARFfv5.nitachra2-4/+28
GDB throws the error 'Unrecognized DWARF opcode 0x02 at 2' when running Info address command with the executable file compiled with -gdwarf-5 flag. This patch fixes this error. Tested by running the testsuite before and after the patch and there is no increase in the number of test cases that fails. Tested with both -gdwarf-4 and -gdwarf-5 flags. Also tested -gslit-dwarf along with -gdwarf-4 as well as -gdwarf-5 flags. Used clang version 10.0.0. This is the test case used- void bar(int arr[], int l, int m, int r) { int i, j, k, n1= m - l + 1, n2= r - m, L[n1], R[n2]; for (i = 0; i < n1; i++) L[i] = arr[l + i]; for (j = 0; j < n2; j++) R[j] = arr[m + 1+ j]; } int main() { int arr[] = {12, 11}; bar(arr,0,1,2); return 0; } clang -gdwarf-5 test.c -o test.out gdb test.out gdb> start gdb> step gdb> step gdb> step gdb> step gdb> info address L Symbol "L" is multi-location: Range 0x7c04007902bc5084-0x67fb876440700: a complex DWARF expression: 0: DW_OP_breg16 1 [$rip] Unrecognized DWARF opcode 0x02 at 2 gdb/ChangeLog: 2020-04-07 Nitika Achra <Nitika.Achra@amd.com> * dwarf2/loc.c (loclist_describe_location): Call the function decode_debug_loclists_ addresses if DWARF version is 5 or more because DW_LLE_start* or DW_LLE_offset_pair with DW_LLE_base_addressx are being emitted in DWARFv5. Add the newly added kind DW_LOC_OFFSET_PAIR also. The length of location description is an unsigned ULEB integer in DWARFv5 instead of unsigned integer.
2020-04-07DWARFv5: Handle location list for split dwarf.nitachra2-5/+24
GDB throws the error '<error reading variable: dwarf2_find_location_ expression: Corrupted DWARF expression.>' while printing the variable value with executable file compiled with -gdwarf-5 and -gdwarf-split flags. This is because DW_LLE_start* or DW_LLE_offset_pair with DW_LLE_base_addressx are being emitted in DWARFv5 location list instead of DW_LLE_GNU*. This patch fixes this error. Tested by running the testsuite before and after the patch and there is no increase in the number of test cases that fails. Tested with both -gdwarf-4 and -gdwarf-5 flags. Also tested -gslit-dwarf along with -gdwarf-4 as well as -gdwarf-5 flags. Used clang version 10.0.0. This is the test case used- void bar(int arr[], int l, int m, int r) { int i, j, k, n1= m - l + 1, n2= r - m, L[n1], R[n2]; for (i = 0; i < n1; i++) L[i] = arr[l + i]; for (j = 0; j < n2; j++) R[j] = arr[m + 1+ j]; } int main() { int arr[] = {12, 11}; bar(arr,0,1,2); return 0; } clang -gdwarf-5 -gsplit-dwarf test.c -o test.out gdb test.out gdb> start gdb> step gdb> step gdb> step gdb> step gdb> p L[0] dwarf2_find_location_expression: Corrupted DWARF expression. gdb/ChangeLog: 2020-04-07 Nitika Achra <Nitika.Achra@amd.com> * dwarf2/loc.c (enum debug_loc_kind): Add a new kind DEBUG_LOC_OFFSET_PAIR. (dwarf2_find_location_expression): Call the function decode_debug_loclists_ addresses if DWARF version is 5 or more. DW_LLE_start* or DW_LLE_offset_pair with DW_LLE_base_addressx are being emitted in DWARFv5 instead of DW_LLE_GNU*. Add applicable base address if the entry is DW_LLE_offset_pair from DWO. (decode_debug_loclists_addresses): Return DEBUG_LOC_OFFSET_PAIR instead of DEBUG_LOC_START_END in case of DW_LLE_offset_pair.
2020-04-07Support for DW_AT_loclists_base and DW_FORM_loclistx.nitachra3-1/+151
Hi Tom, This is the updated series with ChangeLogs edits. Regards, Nitika
2020-04-07gdb: small cleanups in dwarf2_psymtab constructorsSimon Marchi3-9/+11
I noticed that only one of the two dwarf2_psymtab constructors are actually used. The one that is used accepts an `addr` parameter (the base text offset), but its sole caller passes a constant, 0. We want to keep calling the three-arguments standard_psymtab constructor form, however, since it differs from the two-arguments form in subtle ways. Also, I believe the dwarf2_per_cu_data associated to the created dwarf2_psymtab should be passed as a constructor argument. That will help me in a future patchset, to convince myself that the `per_cu_data` field can't be NULL. So this patch: - Removes the two-parameters constructor of dwarf2_psymtab, as it is unused. - Removes the `addr` parameter of the remaining constructor, passing 0 directly to the base class' constructor. - Adds a `per_cu` parameter, to assign the `per_cu_data` field at construction. gdb/ChangeLog: * dwarf2/read.h (struct dwarf2_psymtab): Remove two-parameters constructor. Remove `addr` parameter from other constructor and add `per_cu` parameter. * dwarf2/read.c (create_partial_symtab): Update.
2020-04-07[gdb/symtab] Add symbol with inherited DW_AT_const_value to psymtabsTom de Vries4-0/+146
Consider the test-case added in this patch, with resulting dwarf (related to variable aaa): ... <0><d2>: Abbrev Number: 2 (DW_TAG_partial_unit) <1><eb>: Abbrev Number: 4 (DW_TAG_variable) <ec> DW_AT_name : aaa <f0> DW_AT_type : <0xe4> <f4> DW_AT_const_value : 1 <0><10c>: Abbrev Number: 2 (DW_TAG_compile_unit) <10e> DW_AT_name : <artificial> <1><11b>: Abbrev Number: 3 (DW_TAG_variable) <11c> DW_AT_abstract_origin: <0xeb> ... When running the test-case, we see: ... (gdb) p aaa^M No symbol "aaa" in current context.^M (gdb) FAIL: gdb.dwarf2/imported-unit-abstract-const-value.exp: p aaa ... while with target board readnow.exp, we have: ... (gdb) p aaa^M $1 = 1^M ... This is due to the fact that there's no aaa symbol in the partial symtabs: ... Partial symtab for source file <artificial>@0x101 (object 0x351cf40)^M ... Global partial symbols:^M `main', function, 0x4004a7^M ^M ... which is due to the fact that when attempting to add the symbol corresponding to DIE 0x11b in add_partial_symbol: ... (gdb) p /x pdi->sect_off $4 = 0x11b (gdb) p pdi.has_const_value $5 = 0 ... it seems the DW_AT_const_value was not inherited from DIE 0xeb, and consequently we leave without adding a partial symbol. Fix this by making sure that partial_die_info::has_const_value is inherited in partial_die_info::fixup. Build and reg-tested on x86_64-linux. Tested test-case with target boards readnow, cc-with-gdb-index and cc-with-debug-names. The "print aaa" test fails for cc-with-gdb-index, that's PR25791, the test passes when applying the corresponding proposed patch. gdb/ChangeLog: 2020-04-07 Tom de Vries <tdevries@suse.de> PR symtab/25796 * dwarf2/read.c (can_have_DW_AT_const_value_p): New function. (partial_die_info::fixup): Inherit has_const_value. gdb/testsuite/ChangeLog: 2020-04-07 Tom de Vries <tdevries@suse.de> PR symtab/25796 * gdb.dwarf2/imported-unit-abstract-const-value.exp: New file.
2020-04-07ChangeLog entry for last change.Rainer Orth1-0/+7
2020-04-07ld: Fix several 32-bit SPARC plugin testsRainer Orth1-15/+19
Several ld plugin tests currently FAIL on 32-bit Solaris/SPARC: FAIL: load plugin with source FAIL: plugin claimfile lost symbol with source FAIL: plugin claimfile replace symbol with source FAIL: plugin claimfile resolve symbol with source FAIL: plugin claimfile replace file with source FAIL: plugin set symbol visibility with source FAIL: plugin ignore lib with source FAIL: plugin claimfile replace lib with source FAIL: plugin 2 with source lib FAIL: load plugin 2 with source FAIL: load plugin 2 with source and -r FAIL: plugin 3 with source lib FAIL: load plugin 3 with source FAIL: load plugin 3 with source and -r FAIL: PR ld/20070 all of them in the same way: ./ld-new: BFD (GNU Binutils) 2.34.50.20200328 internal error, aborting at /vol/src/gnu/binutils/hg/master/git/bfd/elf32-sparc.c:154 in sparc_final_write_processing This happens when bfd_get_mach returns 0 when abfd refers to a source file: $11 = { filename = 0x28c358 "/vol/src/gnu/binutils/hg/master/local/ld/testsuite/ld-plugin/func.c (symbol from plugin)", xvec = 0x24ed6c <sparc_elf32_sol2_vec>, [...] While I could find no specification what abfd's are allowed/expected in *_final_write_processing, I could find no other target that behaved the same. And indeed ignoring the 0 case fixes the failures. The code now errors for other values. 64-bit SPARC is not affected because it doesn't have a specific implementation of elf_backend_final_write_processing. Tested on sparc-sun-solaris2.11. 2020-04-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> Nick Clifton <nickc@redhat.com> * elf32-sparc.c (sparc_final_write_processing): Fix whitespace. <0>: Ignore. <default>: Error rather than abort.
2020-04-07gas: Mention support for Intel SERIALIZE and TSXLDTRKH.J. Lu2-0/+7
* NEWS: Mention support for Intel SERIALIZE and TSXLDTRK instructions.
2020-04-07gas/doc/c-z80.texi: Fix @xref warningsH.J. Lu2-5/+13
Fix gas/doc/c-z80.texi:244: warning: `.' or `,' must follow @xref, not ) gas/doc/c-z80.texi:278: warning: `.' or `,' must follow @xref, not ) gas/doc/c-z80.texi:284: warning: `.' or `,' must follow @xref, not ) gas/doc/c-z80.texi:291: warning: `.' or `,' must follow @xref, not ) gas/doc/c-z80.texi:295: warning: `.' or `,' must follow @xref, not ) * doc/c-z80.texi: Fix @xref warnings.
2020-04-07[gdb/symtab] Fix check-psymtab failure for inline functionTom de Vries5-7/+73
Consider test-case inline.c, containing an inline function foo: ... static inline int foo (void) { return 0; } int main (void) { return foo (); } ... And the test-case compiled with -O2 and debug info: ... $ gcc -g inline.c -O2 ... This results in a DWARF entry for foo without pc info: ... <1><114>: Abbrev Number: 4 (DW_TAG_subprogram) <115> DW_AT_name : foo <119> DW_AT_decl_file : 1 <11a> DW_AT_decl_line : 2 <11b> DW_AT_prototyped : 1 <11b> DW_AT_type : <0x10d> <11f> DW_AT_inline : 3 (declared as inline and inlined) ... When loading the executable in gdb, we create a partial symbol for foo, but after expansion into a full symbol table no actual symbol is created, resulting in a maint check-psymtab failure: ... (gdb) maint check-psymtab Static symbol `foo' only found in inline.c psymtab ... Fix this by skipping this type of partial symbol during the check. Note that we're not fixing this by not creating the partial symbol, because this breaks setting a breakpoint on an inlined inline function in a CU for which the partial symtab has not been expanded (test-case gdb.dwarf2/break-inline-psymtab.exp). Tested on x86_64-linux. gdb/ChangeLog: 2020-04-07 Tom de Vries <tdevries@suse.de> * psymtab.c (maintenance_check_psymtabs): Skip static LOC_BLOCK symbols without address. gdb/testsuite/ChangeLog: 2020-04-07 Tom de Vries <tdevries@suse.de> * gdb.base/check-psymtab.c: New test. * gdb.base/check-psymtab.exp: New file.
2020-04-07Add support for intel TSXLDTRK instructions$Cui,Lili14-4155/+4284
gas/ * config/tc-i386.c (cpu_arch): Add .TSXLDTRK. (cpu_noarch): Likewise. * doc/c-i386.texi: Document TSXLDTRK. * testsuite/gas/i386/i386.exp: Run TSXLDTRK tests. * testsuite/gas/i386/tsxldtrk.d: Likewise. * testsuite/gas/i386/tsxldtrk.s: Likewise. * testsuite/gas/i386/x86-64-tsxldtrk.d: Likewise. opcodes/ * i386-dis.c (enum): Add PREFIX_0F01_REG_5_MOD_3_RM_1, (prefix_table): New instructions (see prefixes above). (rm_table): Likewise. * i386-gen.c (cpu_flag_init): Add CPU_TSXLDTRK_FLAGS, CPU_ANY_TSXLDTRK_FLAGS. (cpu_flags): Add CpuTSXLDTRK. * i386-opc.h (enum): Add CpuTSXLDTRK. (i386_cpu_flags): Add cputsxldtrk. * i386-opc.tbl: Add XSUSPLDTRK insns. * i386-init.h: Regenerate. * i386-tbl.h: Likewise.
2020-04-07Automatic date update in version.inGDB Administrator1-1/+1
2020-04-06Implement basic threading support in the NetBSD targetKamil Rytarowski3-0/+185
Use sysctl(3) as the portable interface to prompt NetBSD threads on all supported NetBSD versions. In future newer versions could switch to PT_LWPSTATUS ptrace(2) API that will be supported on NetBSD 10.0 and newer. Implement as part of nbsd_nat_target: - thread_name() - read descriptive thread name - thread_alive() - check whether a thread is alive - post_attach() - updates the list of threads after attach - update_thread_list() - updates the list of threads - pid_to_str() - translates ptid to a descriptive string There are two local static functions: - nbsd_thread_lister() - generic LWP lister for a specified pid - nbsd_add_threads() - utility to update the list of threads Now, GDB on NetBSD can attach to a multithreaded process, spawn a multithreaded process, list threads, print their LWP+PID numbers and descriptive thread names. gdb/ChangeLog: * nbsd-nat.h (struct thread_info): Add forward declaration. (nbsd_nat_target::thread_alive): Add. (nbsd_nat_target::thread_name): Likewise. (nbsd_nat_target::update_thread_list): Likewise. (update_thread_list::post_attach): Likewise. (post_attach::pid_to_str): Likewise. * nbsd-nat.c: Include "gdbthread.h" and "inferior.h". (nbsd_thread_lister): Add. (nbsd_nat_target::thread_alive): Likewise. (nbsd_nat_target::thread_name): Likewise. (nbsd_add_threads): Likewise. (update_thread_list::post_attach): Likewise. (nbsd_nat_target::update_thread_list): Likewise. (post_attach::pid_to_str): Likewise.
2020-04-06Select variant field when printing variantTom Tromey7-2/+146
When I updated the Ada variant-printing code to be value-based, I neglected a couple of issues. First, print_variant_part must first extract the variant field before finding the active component; second, print_field_values should pass in the field value as the outer value when recursing. This patch fixes both of these issues. gdb/ChangeLog 2020-04-06 Tom Tromey <tromey@adacore.com> * ada-valprint.c (print_variant_part): Extract the variant field. (print_field_values): Use the field as the outer value when recursing. gdb/testsuite/ChangeLog 2020-04-06 Tom Tromey <tromey@adacore.com> * gdb.ada/variant-record/proc.adb: New file. * gdb.ada/variant-record/value.adb: New file. * gdb.ada/variant-record/value.s: New file. * gdb.ada/variant-record.exp: New file.
2020-04-06Fix build breakage in NetBSD tdep filesTom Tromey7-2/+15
A recent patch caused some build failures in NetBSD tdep files. I saw this failure in my --enable-target=all build. This patch fixes the problems. Tested by rebuilding. I am going to check this in. gdb/ChangeLog 2020-04-06 Tom Tromey <tromey@adacore.com> * sh-nbsd-tdep.c: Include nbsd-tdep.h. * ppc-nbsd-tdep.c: Include nbsd-tdep.h. * mips-nbsd-tdep.c (mipsnbsd_init_abi): Add missing ";". * arm-nbsd-tdep.c: Include nbsd-tdep.h. * hppa-nbsd-tdep.c: Include nbsd-tdep.h.
2020-04-06Handle complex error type in read_base_typeTom Tromey2-1/+18
It turns out there was one more bug in the earlier complex series: read_base_type could cause an assertion failure on some platforms. I found this running the AdaCore internal test suite, but you can also see it by running gdb's "gdb.cp" tests for x86 (not x86-64). In particular, the DW_ATE_complex_float case calls dwarf2_init_complex_target_type, which calls dwarf2_init_float_type, which can return a type using TYPE_CODE_ERROR. This patch changes the DWARF reader to handle this case, the same way that the f-lang.c patch did. Perhaps init_complex_type really should be changed to allow TYPE_CODE_ERROR? I was not sure. Tested on x86-64 Fedora 30, using an x86 build. I'm checking this in. gdb/ChangeLog 2020-04-06 Tom Tromey <tromey@adacore.com> * dwarf2/read.c (read_base_type) <DW_ATE_complex_float>: Handle TYPE_CODE_ERROR.
2020-04-06Add signal number conversions for NetBSDKamil Rytarowski14-0/+342
gdb/ChangeLog: * nbsd-tdep.c: Include "gdbarch.h". Define enum with NetBSD signal numbers. (nbsd_gdb_signal_from_target, nbsd_gdb_signal_to_target): New. * alpha-nbsd-tdep.c (alphanbsd_init_abi): Call nbsd_init_abi(). * amd64-nbsd-tdep.c (amd64nbsd_init_abi): Likewise. * arm-nbsd-tdep.c (arm_netbsd_elf_init_abi): Likewise. * hppa-nbsd-tdep.c (hppanbsd_init_abi): Likewise. * i386-nbsd-tdep.c (i386nbsd_init_abi): Likewise. * mips-nbsd-tdep.c (nbsd_init_abi): Likewise. * ppc-nbsd-tdep.c (ppcnbsd_init_abi): Likewise. * sh-nbsd-tdep.c (shnbsd_init_abi): Likewise. * sparc-nbsd-tdep.c (sparc32nbsd_init_abi): Likewise. * sparc64-nbsd-tdep.c (sparc64nbsd_init_abi): Likewise. * vax-nbsd-tdep.c (vaxnbsd_elf_init_abi): Likewise.
2020-04-06Automatic date update in version.inGDB Administrator1-1/+1
2020-04-05Automatic date update in version.inGDB Administrator1-1/+1
2020-04-03elf: Remove zero-sized relocation section from section groupH.J. Lu2-11/+32
Remove zero-sized relocation section from a section group since it has been removed from the output. PR ld/25767 * elf.c (_bfd_elf_fixup_group_sections): Remove zero-sized relocation section from section group.
2020-04-04Automatic date update in version.inGDB Administrator1-1/+1