aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-08-03gdb: follow-fork: push target and add thread in target_follow_forkSimon Marchi15-142/+172
In the context of ROCm-gdb [1], the ROCm target sits on top of the linux-nat target. when a process forks, it needs to carry over some data from the forking inferior to the fork child inferior. Ideally, the ROCm target would implement the follow_fork target_ops method, but there are some small problems. This patch fixes these, which helps the ROCm target, but also makes things more consistent and a bit nicer in general, I believe. The main problem is: when follow-fork-mode is "parent", target_follow_fork is called with the parent as the current inferior. When it's "child", target_follow_fork is called with the child as the current inferior. This means that target_follow_fork is sometimes called on the parent's target stack and sometimes on the child's target stack. The parent's target stack may contain targets above the process target, such as the ROCm target. So if follow-fork-child is "parent", the ROCm target would get notified of the fork and do whatever is needed. But the child's target stack, at that moment, only contains the exec and process target copied over from the parent. The child's target stack is set up by follow_fork_inferior, before calling target_follow_fork. In that case, the ROCm target wouldn't get notified of the fork. For consistency, I think it would be good to always call target_follow_fork on the parent inferior's target stack. I think it makes sense as a way to indicate "this inferior has called fork, do whatever is needed". The desired outcome of the fork (whether an inferior is created for the child, do we need to detach from the child) can be indicated by passed parameter. I therefore propose these changes: - make follow_fork_inferior always call target_follow_fork with the parent as the current inferior. That lets all targets present on the parent's target stack do some fork-related handling and push themselves on the fork child's target stack if needed. For this purpose, pass the child inferior down to target_follow_fork and follow_fork implementations. This is nullptr if no inferior is created for the child, because we want to detach from it. - as a result, in follow_fork_inferior, detach from the parent inferior (if needed) only after the target_follow_fork call. This is needed because we want to call target_follow_fork before the parent's target stack is torn down. - hand over to the targets in the parent's target stack (including the process target) the responsibility to push themselves, if needed, to the child's target stack. Also hand over the responsibility to the process target, at the same time, to create the child's initial thread (just like we do for follow_exec). - pass the child inferior to exec_on_vfork, so we don't need to swap the current inferior between parent and child. Nothing in exec_on_vfork depends on the current inferior, after this change. Although this could perhaps be replaced with just having the exec target implement follow_fork and push itself in the child's target stack, like the process target does... We would just need to make sure the process target calls beneath()->follow_fork(...). I'm not sure about this one. gdb/ChangeLog: * target.h (struct target_ops) <follow_fork>: Add inferior* parameter. (target_follow_fork): Likewise. * target.c (default_follow_fork): Likewise. (target_follow_fork): Likewise. * fbsd-nat.h (class fbsd_nat_target) <follow_fork>: Likewise. (fbsd_nat_target::follow_fork): Likewise, and call inf_ptrace_target::follow_fork. * linux-nat.h (class linux_nat_target) <follow_fork>: Likewise. * linux-nat.c (linux_nat_target::follow_fork): Likewise, and call inf_ptrace_target::follow_fork. * obsd-nat.h (obsd_nat_target) <follow_fork>: Likewise. * obsd-nat.c (obsd_nat_target::follow_fork): Likewise, and call inf_ptrace_target::follow_fork. * remote.c (class remote_target) <follow_fork>: Likewise. (remote_target::follow_fork): Likewise, and call process_stratum_target::follow_fork. * process-stratum-target.h (class process_stratum_target) <follow_fork>: New. * process-stratum-target.c (process_stratum_target::follow_fork): New. * target-delegates.c: Re-generate. [1] https://github.com/ROCm-Developer-Tools/ROCgdb Change-Id: I460bd0af850f0485e8aed4b24c6d8262a4c69929
2021-08-04Automatic date update in version.inGDB Administrator1-1/+1
2021-08-03Fixes for mi-fortran-modules.exp fixesCarl Love1-2/+2
Output has additional information for a given filename. gdb/testsuite/ChangeLog * gdb.mi/mi-fortran-modules.exp (system_modules_pattern, system_module_symbols_pattern): Add check for additional symbols on the line
2021-08-03gdbsupport: add debug assertions in gdb::optional::getSimon Marchi1-2/+14
The libstdc++ version of optional contains some runtime checks enabled when _GLIBCXX_DEBUG is defined. I think it would be useful if our version contained similar checks. Add checks in the two `get` methods, also conditional on _GLIBCXX_DEBUG. I think it's simpler to use that macro rather than introducing a new GDB-specific one, as I think that if somebody is interested in enabling these runtime checks, they'll also be interested in enabling the libstdc++ runtime checks (and vice-versa). I implemented these checks using gdb_assert. Note that gdb_assert throws (after querying the user), and we are in noexcept methods. That means that std::terminate / abort will immediately be called. I think this is ok, since if those were "real" _GLIBCXX_DEBUG checks, abort would be called straight away. If I add a dummy failure, it looks like so: $ ./gdb -q -nx --data-directory=data-directory /home/simark/src/binutils-gdb/gdb/../gdbsupport/gdb_optional.h:206: internal-error: T& gdb::optional<T>::get() [with T = int]: Assertion `this->has_value ()' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) n [1] 658767 abort (core dumped) ./gdb -q -nx --data-directory=data-directory Change-Id: Iadfdcd131425bd2ca6a2de30d7b22e9b3cc67793
2021-08-03[gdb/testsuite] templates.exp to accept clang++ outputAlok Kumar Sharma1-0/+3
Please consider below testcase with intended error. `````````` constexpr const char cstring[] = "Eta"; template <const char*, typename T> class Column {}; using quick = Column<cstring,double>; // cstring without '&' void lookup() { quick c1; c1.ls(); } `````````` It produces below error. `````````` no member named 'ls' in 'Column<&cstring, double>'. `````````` Please note that error message contains '&' for cstring, which is absent in actual program. Clang++ does not generate & in such cases and this should also be accepted as correct output. gdb/testsuite/ChangeLog: * gdb.cp/templates.exp: Accept different but correct output from the Clang++ compiled binary also.
2021-08-03Automatic date update in version.inGDB Administrator1-1/+1
2021-08-02Handle compiler-generated suffixes in Ada namesTom Tromey3-1/+120
The compiler may add a suffix to a mangled name. A typical example would be splitting a function and creating a ".cold" variant. This patch changes Ada decoding (aka demangling) to handle these suffixes. It also changes the encoding process to handle them as well. A symbol like "function.cold" will now be displayed to the user as "function[cold]". The "." is not simply preserved because that is already used in Ada.
2021-08-02Remove uses of fprintf_symbol_filteredTom Tromey3-17/+7
I believe that many calls to fprintf_symbol_filtered are incorrect. In particular, there are some that pass a symbol's print name, like: fprintf_symbol_filtered (gdb_stdout, sym->print_name (), current_language->la_language, DMGL_ANSI); fprintf_symbol_filtered uses the "demangle" global to decide whether or not to demangle -- but print_name does this as well. This can lead to double-demangling. Normally this could be innocuous, except I also plan to change Ada demangling in a way that causes this to fail.
2021-08-02Handle type qualifier for enumeration nameTom Tromey4-2/+112
Pierre-Marie noticed that the Ada expression "TYPE'(NAME)" resolved incorrectly when "TYPE" was an enumeration type. Here, "NAME" should be unambiguous. This patch fixes this problem. Note that the patch is not perfect -- it does not give an error if TYPE is an enumeration type but NAME is not an enumerator but does have some other meaning in scope. Fixing this proved difficult, and so I've left it out.
2021-08-02Remove the type_qualifier globalTom Tromey1-13/+1
The type_qualifier global is no longer needed in the Ada expression parser, so this removes it.
2021-08-02Defer Ada character literal resolutionTom Tromey7-44/+204
In Ada, an enumeration type can use a character literal as one of the enumerators. The Ada expression parser handles the appropriate conversion. It turns out, though, that this conversion was handled incorrectly. For an expression like TYPE'(EXP), the conversion would be done for any such literal appearing in EXP -- but only the outermost such expression should really be affected. This patch defers the conversion until the resolution phase, fixing the bug.
2021-08-02Refactor Ada resolutionTom Tromey3-10/+42
In a subsequent patch, it will be convenient if an Ada expression operation can supply its own replacement object. This patch refactors Ada expression resolution to make this possible.
2021-08-02Remove add_symbols_from_enclosing_procsTom Tromey1-28/+2
I noticed that add_symbols_from_enclosing_procs is empty, and can be removed. The one caller, ada_add_local_symbols, can also be simplified, removing some code that, I think, was an incorrect attempt to handle nested functions.
2021-08-02Avoid crash in varobj deletionTom Tromey2-2/+16
PR varobj/28131 points out a crash in the varobj deletion code. It took a while to reproduce this, but essentially what happens is that a top-level varobj deletes its root object, then deletes the "dynamic" object. However, deletion of the dynamic object may cause ~py_varobj_iter to run, which in turn uses gdbpy_enter_varobj: gdbpy_enter_varobj::gdbpy_enter_varobj (const struct varobj *var) : gdbpy_enter (var->root->exp->gdbarch, var->root->exp->language_defn) { } However, because var->root has already been destroyed, this is invalid. I've added a new test case. This doesn't reliably crash, but the problem can easily be seen under valgrind (and, I presume, with ASAN, though I did not try this). Tested on x86-64 Fedora 32. I also propose putting this on the GDB 11 branch, with a suitable ChangeLog entry of course. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28131
2021-08-02[gdb/testsuite] Fix gdb.dwarf2/dw2-using-debug-str.exp with cc-with-dwz-mTom de Vries1-0/+13
When running with target board cc-with-dwz-m, we run into: ... (gdb) file dw2-using-debug-str-no-debug-str^M Reading symbols from dw2-using-debug-str-no-debug-str...^M (gdb) FAIL: gdb.dwarf2/dw2-using-debug-str.exp: file dw2-using-debug-str ... With native, the .debug_str section is present in the dw2-using-debug-str executable, and removed from the dw2-using-debug-str-no-debug-str executable. When loading the latter, a dwarf error is triggered. With cc-with-dwz-m, the .debug_str section is not present in the dw2-using-debug-str executable, because it's already moved to .tmp/dw2-using-debug-str.dwz. Consequently, the removal has no effect, and no dwarf error is triggered, which causes the FAIL. The same problem arises with target board cc-with-gnu-debuglink. Fix this by detecting whether the .debug_str section is missing, and skipping the remainder of the test-case. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2021-08-02 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/dw2-using-debug-str.exp: Handle missing .debug_str section in dw2-using-debug-str.
2021-08-02[gdb/testsuite] Fix gdb.dwarf2/dw2-using-debug-str.exp with cc-with-gdb-indexTom de Vries1-12/+16
When running with target board cc-with-gdb-index, we run into: ... (gdb) file dw2-using-debug-str-no-debug-str^M Reading symbols from dw2-using-debug-str-no-debug-str...^M Dwarf Error: DW_FORM_strp used without required section^M (gdb) FAIL: gdb.dwarf2/dw2-using-debug-str.exp: file dw2-using-debug-str ... The test expects the dwarf error, but has no matching pattern for the entire output. Fix this by updating the regexp. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2021-08-02 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/dw2-using-debug-str.exp: Update regexp to match cc-with-gdb-index output.
2021-08-02[gdb/testsuite] Fix gdb.dwarf2/per-bfd-sharing.exp with cc-with-gdb-indexTom de Vries1-1/+5
When running with target board cc-with-gdb-index, we run into: ... rm: cannot remove '/tmp/tmp.JmYTeiuFjj/*.gdb-index': \ No such file or directory^M FAIL: gdb.dwarf2/per-bfd-sharing.exp: \ couldn't remove files in temporary cache dir ... Fix this, as in gdb.base/index-cache.exp, by only FAILing when $expecting_index_cache_use. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2021-08-02 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/per-bfd-sharing.exp: Only expect index-cache files when $expecting_index_cache_use.
2021-08-02[gdb/testsuite] Fix gdb.dwarf2/gdb-index-nodebug.exp with cc-with-gdb-indexTom de Vries1-2/+21
When running with target board cc-with-gdb-index, we run into: ... (gdb) save gdb-index .^M Error while writing index for `gdb-index-nodebug': \ Cannot use an index to create the index^M (gdb) FAIL: gdb.dwarf2/gdb-index-nodebug.exp: try to save gdb index ... Fix this by detecting an already present index, and marking the test unsupported. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2021-08-02 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/gdb-index-nodebug.exp: Mark unsupported when index already present.
2021-08-02[gdb/testsuite] Fix gdb.dwarf2/fission-relative-dwo.exp with cc-with-gdb-indexTom de Vries1-0/+14
When running with target board cc-with-gdb-index, we run into: ... gdb compile failed, warning: Could not find DWO CU \ fission-relative-dwo.dwo(0x1234) referenced by CU at offset 0xc7 \ [in module outputs/gdb.dwarf2/fission-relative-dwo/.tmp/fission-relative-dwo] UNTESTED: gdb.dwarf2/fission-relative-dwo.exp: fission-relative-dwo.exp ERROR: failed to compile fission-relative-dwo ... The problem is that: - the .dwo file is found relative to the executable, and - cc-with-tweaks.sh moves the executable to a temp dir, but not the .dwo file. Fix this by copying the .dwo file alongside the executable in the temp dir. Verified changes using shellcheck. Tested on x86_64-linux. gdb/ChangeLog: 2021-08-02 Tom de Vries <tdevries@suse.de> * contrib/cc-with-tweaks.sh: Copy .dwo files alongside executable.
2021-08-02gdb: Make the builtin "boolean" type an unsigned typeShahab Vahedi2-1/+69
When printing the fields of a register that is of a custom struct type, the "unpack_bits_as_long ()" function is used: do_val_print (...) cp_print_value_fields (...) value_field_bitfield (...) unpack_value_bitfield (...) unpack_bits_as_long (...) This function may sign-extend the extracted field while returning it: val >>= lsbcount; if (...) { valmask = (((ULONGEST) 1) << bitsize) - 1; val &= valmask; if (!field_type->is_unsigned ()) if (val & (valmask ^ (valmask >> 1))) val |= ~valmask; } return val; lsbcount: Number of lower bits to get rid of. bitsize: The bit length of the field to be extracted. val: The register value. field_type: The type of field that is being handled. While the logic here is correct, there is a problem when it is handling "field_type"s of "boolean". Those types are NOT marked as "unsigned" and therefore they end up being sign extended. Although this is not a problem for "false" (0), it definitely causes trouble for "true". This patch constructs the builtin boolean type as such that it is marked as an "unsigned" entity. The issue tackled here was first encountered for arc-elf32 target running on an x86_64 machine. The unit-test introduced in this change has passed for all the targets (--enable-targets=all) running on the same x86_64 host. Fixes: https://sourceware.org/PR28104
2021-08-02Automatic date update in version.inGDB Administrator1-1/+1
2021-08-01[gdb/testsuite] Fix gdb.base/maint.exp with cc-with-gdb-indexTom de Vries1-13/+21
With target board cc-with-gdb-index we run into: ... FAIL: gdb.base/maint.exp: maint print statistics ... The output that is checked is: ... Statistics for 'maint':^M Number of "minimal" symbols read: 53^M Number of "full" symbols read: 40^M Number of "types" defined: 60^M Number of symbol tables: 7^M Number of symbol tables with line tables: 2^M Number of symbol tables with blockvectors: 2^M Number of read CUs: 2^M Number of unread CUs: 5^M Total memory used for objfile obstack: 20320^M Total memory used for BFD obstack: 4064^M Total memory used for string cache: 4064^M ... and the regexp doesn't match because it expects the "Number of read/unread CUs" lines in a different place. Fix this by updating the regexp. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2021-08-01 Tom de Vries <tdevries@suse.de> * gdb.base/maint.exp: Update "maint print statistics" to match output with target board cc-with-gdb-index.
2021-08-01[gdb/testsuite] Fix gdb.base/index-cache.exp with cc-with-gdb-indexTom de Vries1-1/+1
With target board cc-with-gdb-index we run into: ... FAIL: gdb.base/index-cache.exp: couldn't remove files in temporary cache dir ... The problem is that there are no files to remove, because the index cache isn't used, as indicated by $expecting_index_cache_use. Fix this by only FAILing when $expecting_index_cache_use. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2021-08-01 Tom de Vries <tdevries@suse.de> * gdb.base/index-cache.exp:
2021-08-01Automatic date update in version.inGDB Administrator1-1/+1
2021-07-31Automatic date update in version.inGDB Administrator1-1/+1
2021-07-30Use iterator_range in more placesTom Tromey1-50/+9
This changes a couple of spots to replace custom iterator range classes with a specialization of iterator_range. Regression tested on x86-64 Fedora 34.
2021-07-30Replace exception_print_same with operator!=Tom Tromey4-18/+18
I noticed that exception_print_same is only used in a single spot, and it seemed to be better as an operator!= method attached to gdb_exception. Regression tested on x86-64 Fedora 34.
2021-07-30[gdb/build] Disable attribute nonnullTom de Vries1-0/+75
With trunk gcc (12.0) we're running into a -Werror=nonnull-compare build breaker in gdb, which caused a broader review of the usage of the nonnull attribute. The current conclusion is that it's best to disable this. This is explained at length in the gdbsupport/common-defs.h comment. Tested by building with trunk gcc. gdb/ChangeLog: 2021-07-29 Tom de Vries <tdevries@suse.de> * gdbsupport/common-defs.h (ATTRIBUTE_NONNULL): Disable.
2021-07-30gas: ensure XCOFF DWARF subsection are initialized to 0Clément Chigot1-1/+1
debug_abbrev doesn't use end_exp to compute its size. However, it must be NULL. Otherwise, ppc_xcoff_end might try to access uninitialized memory. gas/ * config/tc-ppc.c (ppc_dwsect): Use XCNEW instead of XNEW when creating a new subsection.
2021-07-30bfd: ensure that symbols targeted by DWARF relocations are kept in XCOFFClément Chigot1-79/+106
This patch improves XCOFF garbage collector pass, in order to keep symbols being referenced only by special sections like DWARF sections. bfd/ * xcofflink.c (xcoff_mark): Replace SEC_MARK by gc_mark. Look through relocations even if xcoff_section_data is NULL. (xcoff_sweep): Check if any sections of a file is kept before adding its special sections. Call xcoff_mark for special sessions being kept instead of just marking them. (SEC_MARK): Remove (xcoff_mark_symbol): Replace SEC_MARK by gc_mark. (xcoff_keep_symbol_p): Likewise. (bfd_xcoff_size_dynamic_sections): Likewise. (xcoff_find_tc0): Likewise.
2021-07-30bfd: avoid a crash when debug_section isn't created in XCOFFClément Chigot1-1/+2
bfd/ * xcofflink.c (bfd_xcoff_size_dynamic_sections): Add check to know if debug_section is initialized.
2021-07-30readelf: catch archive_file_size of -1Alan Modra1-3/+1
Fuzzers might put -1 in arhdr.ar_size. If the size is rounded up to and even number of bytes we get zero. * readelf.c (process_archive): Don't round up archive_file_size. Do round up next_arhdr_offset calculation.
2021-07-30reloc_upper_bound size calculationsAlan Modra5-5/+5
Section reloc_count is an unsigned int. Adding one for a NULL terminator to an array of arelent pointers can wrap the count to zero. Avoid that by doing the addition as longs. * coffgen.c (coff_get_reloc_upper_bound): Don't overflow unsigned int expression. * elf.c (_bfd_elf_get_reloc_upper_bound): Likewise. * elf64-sparc.c (elf64_sparc_get_reloc_upper_bound): Likewise. * mach-o.c (bfd_mach_o_get_reloc_upper_bound): Likewise. * vms-alpha.c (alpha_vms_get_reloc_upper_bound): Likewise.
2021-07-30Sanity check _bfd_coff_read_string_tableAlan Modra1-3/+12
* coffgen.c (_bfd_coff_read_string_table): Catch overflows when calculating string table file location.
2021-07-30IMAGE_SCN_LNK_NRELOC_OVFLAlan Modra1-0/+6
From microsoft docs: It is an error if IMAGE_SCN_LNK_NRELOC_OVFL is set and there are fewer than 0xffff relocations in the section. * coffcode.h (coff_set_alignment_hook): Sanity check overflow reloc count.
2021-07-29gdb: fix nr_bits gdb_assert in append_flags_type_fieldSimon Marchi1-1/+1
The assertion gdb_assert (nr_bits >= 1 && nr_bits <= type_bitsize); is not correct. Well, it's correct in that we do want the number of bits to be in the range [1, type_bitsize]. But we don't check anywhere that the end of the specified flag is within the containing type. The following code should generate a failed assertion, as the flag goes past the 32 bits of the underlying type, but it's currently not caught: static void test_print_flag (gdbarch *arch) { type *flags_type = arch_flags_type (arch, "test_type", 32); type *field_type = builtin_type (arch)->builtin_uint32; append_flags_type_field (flags_type, 31, 2, field_type, "invalid"); } (You can test this by registering it as a selftest using selftests::register_test_foreach_arc and running.) Change the assertion to verify that the end bit is within the range of the underlying type. This implicitly verifies that nr_bits is not too big as well, so we don't need a separate assertion for that. Change-Id: I9be79e5fd7a5917bf25b03b598727e6274c892e8 Co-Authored-By: Tony Tye <Tony.Tye@amd.com>
2021-07-30Automatic date update in version.inGDB Administrator1-1/+1
2021-07-29obsd-nat: Report both thread and PID in ::pid_to_str.John Baldwin1-1/+1
This improves the output of info threads when debugging multiple inferiors (e.g. after a fork with detach_on_fork disabled).
2021-07-29obsd-nat: Various fixes for fork following.John Baldwin2-30/+25
- Don't use #ifdef's on ptrace ops. obsd-nat.h didn't include <sys/ptrace.h>, so the virtual methods weren't always overridden causing the fork following to not work. In addition, the thread and fork code is intertwined in ::wait and and the lack of #ifdef's there already assumed both were present. Finally, both of these ptrace ops have been present in OpenBSD for at least 10 years. - Move duplicated code to enable PTRACE_FORK event reporting to a single function and invoke it on new child processes reported via PTRACE_FORK. - Don't return early from PTRACE_FORK handling, but instead reset wptid to the correct ptid if the child reports its event before the parent. This allows the ptid fixup code to add thread IDs if the first event for a process is a PTRACE_FORK event. This also properly returns ptid's with thread IDs when reporting PTRACE_FORK events. - Handle detach_fork by skipping the PT_DETACH.
2021-07-29obsd-nat: Various fixes to obsd_nat_target::wait.John Baldwin1-49/+12
- Call inf_ptrace_target::wait instead of duplicating the code. Replace a check for WIFSTOPPED on the returned status from waitpid by checking for TARGET_WAITKIND_STOPPED in the parsed status as is done in fbsd_nat_target::wait. - Don't use inferior_ptid when deciding if a new process is a child vs parent of the fork. Instead, use find_inferior_pid and assume that if an inferior already exists, the pid in question is the parent; otherwise, the pid is the child. - Don't use inferior_ptid when deciding if the ptid of the process needs to be updated with an LWP ID, or if this is a new thread. Instead, use the approach from fbsd-nat which is to check if a ptid without an LWP exists and if so update the ptid of that thread instead of adding a new thread.
2021-07-29x86-bsd-nat: Only define gdb_ptrace when using debug registers.John Baldwin1-8/+8
This fixes an unused function warning on OpenBSD which does not support PT_GETDBREGS.
2021-07-29Don't compile x86 debug register support on OpenBSD.John Baldwin2-5/+9
Simon Marchi tried gdb on OpenBSD, and it immediately segfaults when running a program. Simon tracked down the problem to x86_dr_low.get_status being nullptr at this point: (lldb) print x86_dr_low.get_status (unsigned long (*)()) $0 = 0x0000000000000000 (lldb) bt * thread #1, stop reason = step over * frame #0: 0x0000033b64b764aa gdb`x86_dr_stopped_data_address(state=0x0000033d7162a310, addr_p=0x00007f7ffffc5688) at x86-dregs.c:645:12 frame #1: 0x0000033b64b766de gdb`x86_dr_stopped_by_watchpoint(state=0x0000033d7162a310) at x86-dregs.c:687:10 frame #2: 0x0000033b64ea5f72 gdb`x86_stopped_by_watchpoint() at x86-nat.c:206:10 frame #3: 0x0000033b64637fbb gdb`x86_nat_target<obsd_nat_target>::stopped_by_watchpoint(this=0x0000033b65252820) at x86-nat.h:100:12 frame #4: 0x0000033b64d3ff11 gdb`target_stopped_by_watchpoint() at target.c:468:46 frame #5: 0x0000033b6469b001 gdb`watchpoints_triggered(ws=0x00007f7ffffc61c8) at breakpoint.c:4790:32 frame #6: 0x0000033b64a8bb8b gdb`handle_signal_stop(ecs=0x00007f7ffffc61a0) at infrun.c:6072:29 frame #7: 0x0000033b64a7e3a7 gdb`handle_inferior_event(ecs=0x00007f7ffffc61a0) at infrun.c:5694:7 frame #8: 0x0000033b64a7c1a0 gdb`fetch_inferior_event() at infrun.c:4090:5 frame #9: 0x0000033b64a51921 gdb`inferior_event_handler(event_type=INF_REG_EVENT) at inf-loop.c:41:7 frame #10: 0x0000033b64a827c9 gdb`infrun_async_inferior_event_handler(data=0x0000000000000000) at infrun.c:9384:3 frame #11: 0x0000033b6465bd4f gdb`check_async_event_handlers() at async-event.c:335:4 frame #12: 0x0000033b65070917 gdb`gdb_do_one_event() at event-loop.cc:216:10 frame #13: 0x0000033b64af0db1 gdb`start_event_loop() at main.c:421:13 frame #14: 0x0000033b64aefe9a gdb`captured_command_loop() at main.c:481:3 frame #15: 0x0000033b64aed5c2 gdb`captured_main(data=0x00007f7ffffc6470) at main.c:1353:4 frame #16: 0x0000033b64aed4f2 gdb`gdb_main(args=0x00007f7ffffc6470) at main.c:1368:7 frame #17: 0x0000033b6459d787 gdb`main(argc=5, argv=0x00007f7ffffc6518) at gdb.c:32:10 frame #18: 0x0000033b6459d521 gdb`___start + 321 On BSDs, get_status is set in _initialize_x86_bsd_nat, but only if HAVE_PT_GETDBREGS is defined. PT_GETDBREGS doesn't exist on OpenBSD, so get_status (and the other fields of x86_dr_low) are left as nullptr. OpenBSD doesn't support getting or setting the x86 debug registers, so fix by omitting debug register support entirely on OpenBSD: - Change x86bsd_nat_target to only inherit from x86_nat_target if PT_GETDBREGS is supported. - Don't include x86-nat.o and nat/x86-dregs.o for OpenBSD/amd64. They were already omitted for OpenBSD/i386.
2021-07-29Fix for gdb.tui/tui-layout-asm.expCarl Love1-2/+30
The width of the window is too narrow to display the entire assembly line. The width of the columns in the window changes as the test walks thru the terminal window output. The column change results in the first and second reads of the same line to differ thus causing the test to fail. Increasing the width of the window keeps the column width consistent thru the test. If the test fails, the added check prints an message to the log file if the failure may be due to the window being too narrow. gdb/testsuite/ChangeLog * gdb.tui/tui-layout-asm.exp: Replace window width of 80 with the tui_asm_window_width variable for the width. Add if count_whitespace check. (count_whitespace): New proc
2021-07-29guile/scm-math: indentation fixesGeorge Barrett1-9/+9
Changes the indenting of a few expressions in vlscm_convert_typed_number to be better in line with the prevailing code style. gdb/ChangeLog: 2021-07-30 George Barrett <bob@bob131.so> * guile/scm-math.c (vlscm_convert_typed_number): Fix the indentation of calls to gdbscm_make_out_of_range_error. Change-Id: I7463998b77c17a00e88058e89b52fa029ee40e03
2021-07-29guile: fix make-value with pointer typeGeorge Barrett4-2/+71
Calling the `make-value' procedure with an integer value and a pointer type for the #:type argument triggers a failed assertion in `get_unsigned_type_max', as that function doesn't consider pointers to be an unsigned type. This commit fixes the issue by adding a separate code path for pointers. As previously suggested, range checking is done using a new helper function in gdbtypes. gdb/ChangeLog: 2021-07-30 George Barrett <bob@bob131.so> * gdbtypes.h (get_pointer_type_max): Add declaration. * gdbtypes.c (get_pointer_type_max): Add definition for new helper function. * guile/scm-math.c (vlscm_convert_typed_number): Add code path for handling conversions to pointer types without failing an assert. gdb/testsuite/ChangeLog: 2021-07-30 George Barrett <bob@bob131.so> * gdb.guile/scm-math.exp (test_value_numeric_ops): Add test for creating pointers with make-value. (test_make_pointer_value, test_pointer_numeric_range): Add test procedures containing checks for integer-to-pointer validation. Change-Id: I9994dd1c848840a3d995f745e6d72867732049f0
2021-07-29gdbtypes: return value from get_unsigned_type_maxGeorge Barrett3-12/+8
Changes the signature of get_unsigned_type_max to return the computed value rather than returning void and writing the value into a pointer passed by the caller. gdb/ChangeLog: 2021-07-30 George Barrett <bob@bob131.so> * gdbtypes.h (get_unsigned_type_max): Change signature to return the result instead of accepting a pointer argument in which to store the result. * gdbtypes.c (get_unsigned_type_max): Likewise. * guile/scm-math.c (vlscm_convert_typed_number): Update caller of get_unsigned_type_max. (vlscm_integer_fits_p): Likewise. Change-Id: Ibb1bf0c0fa181fac7853147dfde082a7d1ae2323
2021-07-29gas: improve C_BSTAT and C_STSYM symbols handling on XCOFFClément Chigot9-8/+90
A C_BSTAT debug symbol specifies the beginning of a static block. Its n_value is the index of the csect containing static symbols. A C_STSYM debug symbol represents the stabstring of a statically allocated symbol. Its n_value is the offset in the csect pointed by the containing C_BSTAT. These two special n_value were not correctly handled both when generating object files with gas or when reading them with objdump. This patch tries to improve that and, above all, to allow gas-generated object files with such symbols to be accepted by AIX ld. bfd/ * coff-bfd.c (bfd_coff_get_syment): Adjust n_value of symbols having fix_value = 1 in order to be an index and not a memory offset. * coffgen.c (coff_get_symbol_info): Likewize. (coff_print_symbol): Likewize. gas/ * config/tc-ppc.c (ppc_frob_label): Don't change within if already set. (ppc_stabx): Remove workaround changing exp.X_add_symbol's within. * config/tc-ppc.h (struct ppc_tc_sy): Update comments. * symbols.c (resolve_symbol_value): Remove symbol update when final_val is 0 and it's an AIX debug symbol. * testsuite/gas/ppc/aix.exp: Add new tests. * testsuite/gas/ppc/xcoff-stsym-32.d: New test. * testsuite/gas/ppc/xcoff-stsym-64.d: New test. * testsuite/gas/ppc/xcoff-stsym.s: New test.
2021-07-28Guile: temporary breakpointsGeorge Barrett4-9/+86
Adds API to the Guile bindings for creating temporary breakpoints and querying whether an existing breakpoint object is temporary. This is effectively a transliteration of the Python implementation. It's worth noting that the added `is_temporary' flag is ignored in the watchpoint registration path. This replicates the behaviour of the Python implementation, but might be a bit surprising for users. gdb/ChangeLog: 2021-06-09 George Barrett <bob@bob131.so> * guile/scm-breakpoint.c (gdbscm_breakpoint_object::spec): Add is_temporary field. (temporary_keyword): Add keyword object for make-breakpoint argument parsing. (gdbscm_make_breakpoint): Accept #:temporary keyword argument and store the value in the allocated object's spec.is_temporary. (gdbscm_register_breakpoint_x): Pass the breakpoint's spec.is_temporary value to create_breakpoint. (gdbscm_breakpoint_temporary): Add breakpoint-temporary? procedure implementation. (breakpoint_functions::make-breakpoint): Update documentation string and fix a typo. (breakpoint_functions::breakpoint-temporary?): Add breakpoint-temporary? procedure. (gdbscm_initialize_breakpoints): Initialise temporary_keyword variable. NEWS (Guile API): Mention new temporary breakpoints API. gdb/doc/ChangeLog: 2021-06-09 George Barrett <bob@bob131.so> * guile.texi (Breakpoints In Guile): Update make-breakpoint documentation to reflect new #:temporary argument. Add documentation for new breakpoint-temporary? procedure. gdb/testsuite/ChangeLog: 2021-06-09 George Barrett <bob@bob131.so> * gdb.guile/scm-breakpoint.exp: Add additional tests for temporary breakpoints. Change-Id: I2de332ee7c256f5591d7141ab3ad50d31b871d17
2021-07-29Automatic date update in version.inGDB Administrator1-1/+1
2021-07-28gdb: clean up some things in features/MakefileSimon Marchi2-72/+1
Clean up some things I noticed: - we generate a regformats/microblaze-with-stack-protect.dat file. I don't think this is used. It could be used by a GDBserver built for Microblaze, but GDBserver isn't ported to Microblaze. So I don't think that's used at all. Remove the entry in features/Makefile and the file itself. - There are a bunch of *-expedite values in features/Makefile for architectures for which we don't generate dat files. AFAIK, these *-expedite values are only used when generating dat files. Remove those that are not necessary. - 32bit-segments.xml is not listed in the Makfile, but it's used. This means that it wouldn't get re-generated if we were to change how C files are generated from the XML. It looks like it was simply forgotten, add it. Change-Id: I112d00db317102270e1df924473c37122ccb6c3a