aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
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
2020-04-03Fix attributes of typed enums of typedefsHannes Domani5-4/+83
For this enum: typedef unsigned char byte; enum byte_enum : byte { byte_val = 128 }; The unsigned attribute is not set: (gdb) p byte_val $1 = -128 That's because it uses the attributes of the 'byte' typedef for the enum. So this changes it to use the attributes of the underlying 'unsigned char' instead. gdb/ChangeLog: 2020-04-03 Hannes Domani <ssbssa@yahoo.de> PR gdb/25325 * dwarf2/read.c (read_enumeration_type): Fix typed enum attributes. gdb/testsuite/ChangeLog: 2020-04-03 Hannes Domani <ssbssa@yahoo.de> PR gdb/25325 * gdb.cp/typed-enum.cc: New test. * gdb.cp/typed-enum.exp: New file.
2020-04-03Fix DWARF disassembly of DW_OP_const_typeTom Tromey2-0/+11
While debugging another issue, I noticed that disassembling a DWARF expression using DW_OP_const_type did not work. disassemble_dwarf_expression was not properly decoding this operation. This patch fixes the problem. Tested by re-debugging gdb. I didn't write a test case because that seemed like overkill for what's essentially a maintainer's helper. The expression evaluator does decode this properly, so no other change was needed. gdb/ChangeLog 2020-04-03 Tom Tromey <tromey@adacore.com> * dwarf2/loc.c (disassemble_dwarf_expression) <DW_OP_const_type>: Read constant block.
2020-04-03Automatic date update in version.inGDB Administrator1-1/+1
2020-04-02gdb: use bfd_get_section_contents to read section contents in ↵Simon Marchi4-8/+36
is_linked_with_cygwin_dll The function is_linked_with_cygwin_dll currently uses gdb_bfd_map_section to get some section contents. This is not ideal because that memory, which is only used in this function, can't be released. Instead, it was suggested to use bfd_get_full_section_contents. However, bfd_get_full_section_contents returns a newly allocated buffer, which is not very practical to use with C++ automatic memory management constructs. I decided to make gdb_bfd_get_full_section_contents, a small alternative to bfd_get_full_section_contents. It is a small wrapper around bfd_get_section_contents which returns the full contents of the section in a gdb::byte_vector. gdb_bfd_get_full_section_contents could be used at many places that already allocate a vector of the size of the section and then call bfd_get_section_contents. I think these call sites can be updated over time. gdb/ChangeLog: * gdb_bfd.h: Include gdbsupport/byte-vector.h. (gdb_bfd_get_full_section_contents): New declaration. * gdb_bfd.c (gdb_bfd_get_full_section_contents): New function. * windows-tdep.c (is_linked_with_cygwin_dll): Use gdb_bfd_get_full_section_contents.
2020-04-02gdb: replace some calls to internal_error with gdb_assertSimon Marchi5-18/+21
There are a few spots using the pattern: if (condition) internal_error (__FILE__, __LINE__, _("failed internal consistency check")); The message brings no value, since it's pretty the description of a failed assertion. Replace a few of these that are obvious with gdb_assert. gdb/ChangeLog: * exec.c (build_section_table): Replace internal_error with gdb_assert. (section_table_xfer_memory_partial): Likewise. * mdebugread.c (parse_partial_symbols): Likewise. * psymtab.c (lookup_partial_symbol): Likewise. * utils.c (wrap_here): Likewise.
2020-04-02Avoid assertion failure due to complex type changeTom Tromey2-2/+12
Tankut Baris Aktemur pointed out that the recent series to change how complex types are handled introduced a regression. This assert in init_complex_type was firing: gdb_assert (TYPE_CODE (target_type) == TYPE_CODE_INT || TYPE_CODE (target_type) == TYPE_CODE_FLT); The problem was that f-lang.c could call init_complex_type with a type whose code was TYPE_CODE_ERROR. It seemed best to me to fix this in f-lang.c, rather than to change init_complex_type to accept error types. Tested on x86-64 Fedora 30. I'm checking this in. gdb/ChangeLog 2020-04-02 Tom Tromey <tromey@adacore.com> * f-lang.c (build_fortran_types): Use arch_type to initialize builtin_complex_s32 in the TYPE_CODE_ERROR case.
2020-04-02Micro-optimize partial_die_info::readTom Tromey2-4/+8
While profiling the DWARF reader, I noticed that partial_die_info::read creates a vector to store attributes. However, the vector is not needed, as this code only processes a single attribute at a time. This patch removes the vector. On my machine, this improves the time of "./gdb ./gdb" from 2.22 seconds to 1.92 seconds (mean times over 10 runs). Note that the attribute is initialized by read_attribute, so it does not need any special initialization. Avoiding this also improves performance a bit. Tested on x86-64 Fedora 30. I'm checking this in. gdb/ChangeLog 2020-04-02 Tom Tromey <tromey@adacore.com> * dwarf2/read.c (partial_die_info::read): Do not create a vector of attributes.
2020-04-02gdb: Don't remove duplicate entries from the line tableAndrew Burgess10-14/+358
In this commit: commit 8c95582da858ac981f689a6f599acacb8c5c490f Date: Mon Dec 30 21:04:51 2019 +0000 gdb: Add support for tracking the DWARF line table is-stmt field A change was made in buildsym_compunit::record_line to remove duplicate line table entries in some cases. This was an invalid change, as these duplicate line table entries are used in _some_ cases as part of prologue detection (see skip_prologue_using_sal). It might be possible to identify those line table entries that are required by skip_prologue_using_sal and only keep those duplicates around, however, I have not done this here. The original duplicate removal was done because (a) it was easy to implement, and (b) it seemed obviously harmless. As (b) is now known to be false, and implementation would be more complex, and so (a) is also false. As such, it seems better to keep all duplicates until an actual reason presents itself for why we should remove any. The original regression was spotted on RISC-V, which makes use of skip_prologue_using_sal as part of riscv_skip_prologue. Originally I created the test gdb.dwarf2/dw2-inline-small-func.exp, however, this test will not compile on RISC-V as this target doesn't support .uleb128 or .sleb128 assembler directives containing complex expressions. As a result I added the gdb.opt/inline-small-func.exp test, which exposes the bug on RISC-V, but obviously depends on the compiler to produce specific DWARF information in order to expose the bug. Still this test does ensure we always get the desired result, even if the DWARF changes. Originally the gdb.dwarf2/dw2-inline-small-func.exp test passed on x86-64 even with the duplicate line table entries incorrectly removed. The reason for this is that when a compilation unit doesn't have a 'producer' string then skip_prologue_using_sal is not used, instead the prologue is always skipped using analysis of the assembler code. However, for Clang on x86-64 skip_prologue_using_sal is used, so I modified the gdb.dwarf2/dw2-inline-small-func.exp test to include a 'producer' string that names the Clang compiler. With this done the test would fail on x86-64. One thing to note is that the gdb.opt/inline-small-func.exp test might fail on some targets. For example, if we compare sparc to risc-v by looking at sparc32_skip_prologue we see that this function doesn't use skip_prologue_using_sal, but instead uses find_pc_partial_function directly. I don't know the full history behind why the code is like it is, but it feels like sparc32_skip_prologue is an attempt to duplicate some of the functionality of skip_prologue_using_sal, but without all of the special cases. If this is true then the new test could easily fail on this target, this would suggest that sparc should consider switching to use skip_prologue_using_sal like risc-v does. gdb/ChangeLog: * buildsym.c (buildsym_compunit::record_line): Remove deduplication code. gdb/testsuite/ChangeLog: * gdb.dwarf2/dw2-inline-small-func-lbls.c: New file. * gdb.dwarf2/dw2-inline-small-func.c: New file. * gdb.dwarf2/dw2-inline-small-func.exp: New file. * gdb.dwarf2/dw2-inline-small-func.h: New file. * gdb.opt/inline-small-func.c: New file. * gdb.opt/inline-small-func.exp: New file. * gdb.opt/inline-small-func.h: New file.
2020-04-02gdb/testsuite: Add support for DW_LNS_set_file to DWARF compilerAndrew Burgess2-0/+10
Extend the Dejagnu DWARF compiler to support DW_LNS_set_file opcode. This will be used in a later commit. There should be no change in the testsuite after this commit. gdb/testsuite/ChangeLog: * lib/dwarf.exp (Dwarf::lines::program::DW_LNS_set_file): New function.
2020-04-02gdb/testsuite: Add compiler options parameter to function_range helperAndrew Burgess2-2/+7
When using the Dejagnu DWARF compiler tests will often use the function_range helper function to extract the extents of a function. If the plan is to compiler the file with non-default compiler flags then we must pass those same compiler flags through to the function_range helper function. This will be used in a later commit, there should be no change in the testsuite behaviour after this commit. gdb/testsuite/ChangeLog: * lib/dwarf.exp (function_range): Allow compiler options to be specified.
2020-04-02[gdb/testsuite] Don't use O2 for inlining in break-inline-psymtab.expTom de Vries3-3/+8
In test-case gdb.dwarf2/break-inline-psymtab.exp we use O2 to enable inlining of bar into foo in break-inline-psymtab-2.c. Instead, enforce inlining using __attribute__((always_inline)), to avoid any optimization-related test issues. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-04-02 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/break-inline-psymtab-2.c (bar): Add __attribute__((always_inline)). * gdb.dwarf2/break-inline-psymtab.exp: Don't use -O2.
2020-04-02NOCF_PROTECTION_CFLAGS: Replace nopie with availableH.J. Lu2-3/+8
* testsuite/config/default.exp (NOCF_PROTECTION_CFLAGS): Replace nopie with available.