aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2025-02-05gdb: restrict configure error with all targets and 64 bit bfd to mipsGuinevere Larsen2-6/+20
The recent commit b601c58034ed755fb765fc13782b6876bffd25d4 causes the gdb configure to fail if --enable-targets=all was requested, but 64 bit bfd was not enabled. This was due to a build failure first reported against mips, and that I also encountered building on a 32 bit mips system, but that looked like a general failure. Further examination showed that this is, in fact, mips-specific (or at least, not completely generic) as other targets like debian-i386 and 32-bit arm could build all targets just fine. This commit restricts the new error to only trigger in mips hosts. Approved-By: Andrew Burgess <aburgess@redhat.com>
2025-02-04[gdb/tui] Clean up asserts in tui_source_window_base::refresh_windowTom de Vries1-2/+3
Commit 1c525b0e037 ("[gdb/tui] Fix assert in tui_source_window_base::refresh_window") added an early return in tui_source_window_base::refresh_window. Assert after the early return that "m_pad != nullptr", and clean up the following asserts that allow for m_pad == nullptr. Tested on x86_64-linux. Reported-By: Andrew Burgess <aburgess@redhat.com> Co-Authored-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2025-02-04pre-commit: run flake8 on more Python filesSimon Marchi2-14/+13
pre-commit currently runs flake8 only on `gdb/python/**/*.py`. There are more files we can run it on, without running it on all the testsuite files. Add: - gdb/gdb-gdb.py.in - gdb/*.py - gdb/testsuite/*.py Fix the new errors that popped up: gdb/copyright.py:29:21: W605 invalid escape sequence '\*' gdb/copyright.py:29:29: W605 invalid escape sequence '\*' gdb/copyright.py:29:38: W605 invalid escape sequence '\*' gdb/copyright.py:29:46: W605 invalid escape sequence '\*' gdb/copyright.py:34:1: F401 'datetime' imported but unused gdb/testsuite/analyze-racy-logs.py:150:9: E722 do not use bare 'except' Change-Id: Ia864c22d4f170d4e18ce3beb06a86c49966654b2 Approved-By: Tom Tromey <tom@tromey.com>
2025-02-04Reorder gnatmake arguments in inline-section-gc.expTom Tromey1-2/+2
inline-section-gc.exp ends up passing "-lm" to gnatmake as an "marg" -- meaning gnatmake should process it itself. However, the gnat-llvm gnatmake does not know what to do with this, so the test fails. This patch rearranges the arguments so that the (implicit) trailing -lm ends up being passed through to the linker.
2025-02-04gdb/python: add void_type () method to gdb.Architecture objectJan Vrany4-1/+26
This commit adds a new method to Python architecture objects that returns a void type for that architecture. This will be useful later to create types for function symbols created using Python extension code. Reviewed-By: Eli Zaretskii <eliz@gnu.org> Approved-By: Andrew Burgess <aburgess@redhat.com>
2025-02-04gdb/python: add domain property to gdb.SymbolJan Vrany4-2/+24
Reviewed-By: Eli Zaretskii <eliz@gnu.org> Approved-By: Andrew Burgess <aburgess@redhat.com>
2025-02-04gdb/python: add subblocks property to gdb.BlockJan Vrany4-3/+48
This commit adds new propery "subblocks" to gdb.Block objects. This allows Python to traverse block tree starting with global block. Reviewed-By: Eli Zaretskii <eliz@gnu.org> Approved-By: Andrew Burgess <aburgess@redhat.com>
2025-02-04[gdb/testsuite] Fix gdb.ada/big_packed_array.exp on s390x-linuxTom de Vries1-1/+8
When running test-case gdb.ada/big_packed_array.exp on s390x-linux, I run into: ... (gdb) print bad^M $2 = (0 => 0 <repeats 24 times>, 1)^M (gdb) FAIL: gdb.ada/big_packed_array.exp: scenario=minimal: print bad ... This is with gcc 7.5.0, and this xfail should trigger: ... if { $have_xfail && [string is integer $last] \ && [expr ($last & 0xf) == 0] } { # gcc/101643 setup_xfail *-*-* } ... but it doesn't because $last is '1'. Fix this by using 0xf0 as mask for big endian. Tested on s390x-linux.
2025-02-04[gdb/testsuite] Fix gdb.ada/convvar_comp.exp on s390x-linuxTom de Vries2-2/+4
When running test-case gdb.ada/convvar_comp.exp on s390x-linux, I get: ... (gdb) run ^M Starting program: pb16_063 ^M ^M Breakpoint 1, pck.break_me (item=...) at pck.adb:17^M 17 function Break_Me (Item : T) return Boolean is^M (gdb) print item.started^M Cannot access memory at address 0x0^M (gdb) FAIL: gdb.ada/convvar_comp.exp: print item.started ... This happens as follows. The parameter item is available in (DW_OP_fbreg: -168): ... <2><912>: Abbrev Number: 18 (DW_TAG_formal_parameter) <913> DW_AT_name : (indirect string, offset: 0x14ca): item <919> DW_AT_type : <0x929> <91d> DW_AT_location : 3 byte block: 91 d8 7e (DW_OP_fbreg: -168) ... and according to the rules of -O0, it's considered to be available after the prologue, which looks like this: ... 0000000001002998 <pck__break_me>: 1002998: b3 c1 00 2b ldgr %f2,%r11 100299c: b3 c1 00 0f ldgr %f0,%r15 10029a0: e3 f0 ff 58 ff 71 lay %r15,-168(%r15) 10029a6: b9 04 00 bf lgr %r11,%r15 10029aa: e3 20 b0 a0 00 24 stg %r2,160(%r11) ... To detect the prologue, gdb checks the line info, which looks like this: ... pck.adb: File name Line number Starting address View Stmt pck.adb 17 0x1002998 x pck.adb 17 0x1002998 1 x pck.adb 19 0x10029b0 x pck.adb 20 0x10029b8 x pck.adb - 0x10029c6 ... and gdb concludes that it's an empty prologue, so we stop at 0x1002998 and try to print parameter item, which is not available yet. For more details, see this comment in skip_prologue_using_sal: ... /* For languages other than assembly, treat two consecutive line entries at the same address as a zero-instruction prologue. ... The same thing happens on x86_64-linux, but it causes no problem there, because amd64_skip_prologue decides not to trust the result: ... struct compunit_symtab *cust = find_pc_compunit_symtab (func_addr); /* LLVM backend (Clang/Flang) always emits a line note before the prologue and another one after. We trust clang and newer Intel compilers to emit usable line notes. */ if (post_prologue_pc && (cust != NULL && cust->producer () != nullptr && (producer_is_llvm (cust->producer ()) || producer_is_icc_ge_19 (cust->producer ())))) return std::max (start_pc, post_prologue_pc); ... because the producer is GCC. Work around this by setting a breakpoint on the first statement of pck.break_me instead. Tested on s390x-linux.
2025-02-04[gdb/testsuite] Use c++ flag in c++ test-casesTom de Vries21-25/+108
In some cases, test-cases use c++, but don't add "c++" to the compilation flags. This can cause problems with some compilers. Fix this in some test-cases. Approved-By: Tom Tromey <tom@tromey.com> PR testsuite/30380 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30380
2025-02-04[gdb/testsuite] Fix gdb.base/list-dot-nodebug.exp on openSUSETom de Vries1-1/+1
On openSUSE Leap 15.6 with test-case gdb.base/list-dot-nodebug.exp I run into: ... (gdb) list .^M warning: 1 ../sysdeps/x86_64/crtn.S: No such file or directory^M (gdb) FAIL: $exp: debug=none: print before start ... The intent of the debug=none case is to generate an executable with no debug info. However, we have quite a few CUs with debug info: ... $ readelf -wi outputs/gdb.base/list-dot-nodebug/list-dot-nodebug-none \ | egrep -c " @ " 431 ... This is because this code: ... gdb_gnu_strip_debug $executable no-debuglink ... uses $executable, and the variable is set here: ... set executable ${testfile}-none ... which sets it to "list-dot-nodebug-none" and consequently gdb_gnu_strip_debug cannot find it. Fix this by using "[standard_output_file $executable]" instead. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com> PR testsuite/31721 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31721
2025-02-04[gdb/tui] Remove stale title when showing "No Source Available"Tom de Vries2-0/+7
When running test-case gdb.tui/main.exp, the last command discards the executable file and symbol table: ... (gdb) file No executable file now. Discard symbol table from `main'? (y or n) [answered Y; input not from terminal] No symbol file now. (gdb) ... and we end up with this source window: ... +-tui-layout.c----------------------------------------------------------------+ | | | | | | | | | | | | | [ No Source Available ] | | | | | | | | | | | | | +-----------------------------------------------------------------------------+ ... The source window title shouldn't be showing tui-layout.c. It's the source file containing function main for the executable that was just discarded. Fix this by clearing the title in tui_source_window::erase_source_content. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com>
2025-02-03pre-commit autoupdateSimon Marchi1-1/+1
Run `pre-commit autoupdate`. This picks up a fresh Black version from 2025, and with it comes a small but welcome formatting change. There is a new version of isort as well, but no formatting change there. Change-Id: Ie654a9c14c3a4096893011082668efb57c166fa4
2025-02-03[gdb/syscalls] Sync with strace v6.13Tom de Vries31-87/+91
After syncing with strace v6.13 using: ... $ update-linux-defaults.sh ~/upstream/strace.git ... we have a few new entries in linux-defaults.xml.in: ... <syscall name="getxattrat" groups="descriptor,file"/> <syscall name="listxattrat" groups="descriptor,file"/> <syscall name="removexattrat" groups="descriptor,file"/> <syscall name="setxattrat" groups="descriptor,file"/> ... Regenerate most *-linux.xml.in files using: ... $ ./update-linux-from-src.sh ~/upstream/linux-stable.git ... updating the copyright years, and do so manually for the remaining two. Then regenerate *-linux.xml using make, propagating the groups changes and copyright years. Tested on x86_64-linux. Approved-By: Andrew Burgess <aburgess@redhat.com>
2025-02-02Avoid "text file busy" in dw2-using-debug-str.expTom Tromey1-0/+12
When I run: runtest dw2-using-debug-str.exp ... if I examine the gdb.log, I see: objcopy: unable to copy file '[...]/dw2-using-debug-str'; reason: Text file busy This happens because the inferior is still running, and objcopy -- despite the invocation seemingly not needing this -- tries to open it for writing. This patch works around the objcopy oddity by having gdb exit (killing the inferior) before the invocation. Fixing this points out that the test does not work in the --target_board=cc-with-gdb-index case. This patch also arranges to issue an "untested" here.
2025-01-31Remove obsolete test from gdb.cp/var-tag.expTom Tromey1-10/+1
There is a test in gdb.cp/var-tag.exp that is kfail'd. I happened across this while working on another series and found that the PR it referenced was closed as invalid. On that basis I think the test should be deleted. Reviewed-By: Keith Seitz <keiths@redhat.com>
2025-01-31Show type- and function-domain in maint print psymbolsTom Tromey1-0/+6
I neglected to update "maint print psymbols" when adding TYPE_DOMAIN and FUNCTION_DOMAIN. This would have been mildly helpful when debugging a series I am working on. This patch corrects the oversight. Approved-By: Andrew Burgess <aburgess@redhat.com>
2025-01-31Use "false" when setting cli_stylingTom Tromey1-1/+1
I noticed a spot that uses 0 where "false" is more appropriate.
2025-01-31Add space in name of Rust tuple typeTom Tromey1-1/+1
The Rust compiler emits tuple type names with a space after the comma, like "(i32, f64)". This changes rust-parse.c to follow. This isn't ideal -- probably the DWARF reader should canonicalize these names -- but it is a bit more robust if symbol lookup should change; and anyway this feature of gdb is probably rarely used.
2025-01-30Use "require" a two gdb.dwarf2 test filesTom Tromey2-9/+3
A couple of ".tcl" files in gdb.dwarf2 escaped notice during the "require" refactoring. This patch fixes these to use "require" rather than if/return.
2025-01-30gdb: add first gdbreplay test, connect.expAlexandra Hájková3-0/+294
When the changes on the remote protocol are made, we want to test all the corner cases to prevent regressions. Currently it can be tricky to simulate some corner case conditions that would expose possible regressions. When I want to add or change the remote protocol packet, I need to hack gdbserver to send a corrupted packet or an error to make sure GDB is able to handle such a case. This test makes it easy to send a corruped packet or an error message to GDB using the gdbreplay tool and check GDB deals with it as we expect it to. This test starts a communication with gdbsever setting the remotelog file. Then, it modifies the remotelog with update_log proc, injects an error message instead of the expected replay to the vMustReplyEmpty packet in order to test GDB reacts to the error response properly. After the remotelog modification, this test restarts GDB and starts communication with gdbreply instead of the gdbserver using the remotelog. Add a lib/gdbreplay-support.exp. update_log proc matches lines from GDB to gdbserver in a remotelogfile. Once a match is found then the custom line is used to build a replacement line to send from gdbserver to GDB. Approved-By: Andrew Burgess <aburgess@redhat.com>
2025-01-30Re-enable background readingTom Tromey1-1/+1
All the reported races have been fixed, so this patch re-enabled background DWARF reading. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31751 Tested-By: Tom de Vries <tdevries@suse.de>
2025-01-30gdb: remove unused includes from dwarf2/index-write.cSimon Marchi1-2/+0
These includes are reported as unused by clangd. Change-Id: Ibf3cdc881abad5f5969edca623412ceac7212149
2025-01-30gdb: remove includes from dwarf2/mapped-index.hSimon Marchi4-2/+3
They are unused, according to clangd. Add some includes to other files, which were relying on transitive includes. Change-Id: I3bcb4be93b3a18bf44a4068f4067e567f83e1d4f
2025-01-30gdb: remove unused include from dwarf2/read.cSimon Marchi1-1/+0
It is unused, according to clangd. Change-Id: Ieadb84a2b1953b70d82a28775472fd347a809a62
2025-01-30gdb: remove unused include, add forward declaration in dwarf2/parent-map.hSimon Marchi1-1/+1
dwarf2_per_bfd is used but never declared in this file, forward-declare it. dwarf2/types.h is unused, according to clangd. Change-Id: I324b68894008af20307030c9e36c5abe06e36a78
2025-01-30gdb: remove unused include in symtab.hSimon Marchi1-1/+0
This include is unused, according to clangd. Change-Id: Ifbc2fe75b02c9ae9b3e2f1184bbcc4dc7095a554
2025-01-30gdb: include symtab.h in quick-symbol.hSimon Marchi1-0/+2
quick-symbol.h uses domain_search_flags, defined in symtab.h. Change-Id: I5c4ae272da929eb6a8dd593bcd96a2aacf0ca99f
2025-01-30[gdb/testsuite] Handle unordered dict in gdb.python/py-mi-notify.expTom de Vries1-1/+4
With test-case gdb.python/py-mi-notify.exp and python 3.4, I occasionally run into: ... python gdb.notify_mi('-test-notification', { 'data1' : 1 , 'data2' : 2 }) &"python gdb.notify_mi('-test-notification', { 'data1' : 1 , 'data2' : 2 })\n" =-test-notification,data2="2",data1="1" ^done (gdb) FAIL: $exp: python notification, with additional data (unexpected output) ... In contrast, a passing version looks like: ... python gdb.notify_mi('-test-notification', { 'data1' : 1 , 'data2' : 2 }) &"python gdb.notify_mi('-test-notification', { 'data1' : 1 , 'data2' : 2 })\n" =-test-notification,data1="1",data2="2" ^done (gdb) PASS: gdb.python/py-mi-notify.exp: python notification, with additional data ... The python method "gdb.notify_mi(name, data)" has parameter data which is a dictionary, and it iterates over that dictionary. The problem is that dictionaries are only guaranteed to be iterating in insertion order starting python 3.7 (though cpython does this starting python 3.6). Fix this in the same way as in commit 362a867f2ac ("[gdb/testsuite] Handle unordered dict in gdb.python/py-mi-cmd.exp"): by allowing the alternative order. Tested on x86_64-linux.
2025-01-29Use command style in cmd_show_listTom Tromey3-8/+13
cmd_show_list is a bit funny because it shows partial command names -- for a command like "show abc xyz", it will only show "abc xyz". Nevertheless, I think it makes some sense to highlight these with the command style. That is what this patch does.
2025-01-29Remove "enabled" output from show_index_cache_commandTom Tromey1-5/+0
show_index_cache_command prints whether the index-cache is enabled. This text was added back in 2018 in commit 87d6a7aa (Add DWARF index cache). Then in 2021, the enabling option was changed via commit 7bc5c369 (gdb: introduce "set index-cache enabled", deprecate "set index-cache on/off"). This latter change made this output, IMO, redundant. That is, currently gdb will show: (gdb) show index-cache ... index-cache enabled: The index cache is off. ... The index cache is currently disabled. This patch removes the redundant output.
2025-01-29Use command style in "help" commandTom Tromey9-70/+80
This changes the help command to use the new command style when displaying text like: List of "catch" subcommands: As a side effect, this mildly -- but not hugely -- cleans up some i18n issues in help_list. The header comment for that function is also changed to the gdb style. Finally, this function used to print something like: Type "help catch" followed by catch subcommand name for full documentation. The second "catch" here seems redundant to me, so this patch removes it.
2025-01-29Avoid calling help_list in more placesTom Tromey4-52/+11
I think there is no need to have a prefix command that simply calls help_list. Instead, add_basic_prefix_cmd can be used. This patch changes the relevant instances. In one spot, add_setshow_prefix_cmd is used instead.
2025-01-29gdb: include cli/cli-style.h in darwin-nat.cSimon Marchi1-0/+1
PR 32610 says: File gdb/darwin-nat.c is missing an #include statement of "cli/cli-style.h". It is needed because there is a reference to class object command_style in the .c file. I'm not able to build-test this change (I only have access to arm64 macos machines, which GDB doesn't support yet), but I don't think I'm doing things worse by adding this. Change-Id: I2a169664ff91b92caf27cb084334f2eb4df46aa5
2025-01-29gdb/testsuite: add comments to line table from DWARF assemblerAndrew Burgess1-7/+7
Add comments to the assembler generated by the DWARF assembler that builds the line table. I found these comments useful when debugging issues with the line table parsing. This patch should make no difference to what is being tested. The test binaries should be unchanged after this commit. Approved-By: Kevin Buettner <kevinb@redhat.com>
2025-01-29gdb: move debug output inside block in dwarf_record_line_1Andrew Burgess1-8/+7
The debug output that says a line has been recorded is currently outside the `if` block which decides if the line should be recorded or not. This means the debug output will claim the line was recorded, when actually it wasn't! Fixed by moving the debug output inside the `if` block. Should be no user visible changes after this commit (except if debug output is turned on). Approved-By: Tom Tromey <tom@tromey.com>
2025-01-28MicroBlaze: Add features/microblaze-linux.xmlMichael J. Eager4-0/+157
This is a preparatory patch to support native linux port of gdbserver for MicroBlaze * gdb/features/Makefile : Add microblaze-expedite * gdb/features/microblaze-linux.xml : New * gdb/features/microblaze-linux.c : New (generated) * gdb/regformats/microblaze-linux.dat : New (generated) Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com> Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com> Signed-off-by: Michael J. Eager <eager@eagercon.com>
2025-01-28[gdb/tui] Fix assert in tui_source_window_base::refresh_windowTom de Vries2-0/+6
Say we use the executable of test-case gdb.tui/tui-missing-src.exp like this: ... $ gdb.sh -q -tui outputs/gdb.tui/tui-missing-src/tui-missing-src \ -ex "b f2"\ -ex run ... (from a directory not containing a file called main.c to make sure that the missing source stays missing) and then issue finish: ... (gdb) finish Run till exit from #0 f2 (x=4) at f2.c:5 0x0000000000400570 in main () at main.c:7 Value returned is $1 = 13 (gdb) ... and use control-<minus> to decrease the font size (IOW increase the $LINES and $COLUMNS) on the terminal, we get: ... gdb/tui/tui-winsource.c:340: internal-error: refresh_window: \ Assertion `pad_x + view_width <= pad_width || m_pad.get () == nullptr' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. ... The tui_source_window_base class has variable m_pad which keeps track of a curses pad that is used to display the source code or disassembly efficiently. The assert in tui_source_window_base::refresh_window triggers while preparing to display part of the pad. The problem is that the window is in a state in which the pad is not used, because m_content.empty () == true. Instead, it simply shows "[ No Source Available ]". Fix this by bailing out of tui_source_window_base::refresh_window before accessing the m_pad variable, if m_content.empty () == true. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com> PR tui/32592 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32592
2025-01-28[gdb/guile] Use SCM_DEBUG_TYPING_STRICTNESS 0Tom de Vries1-11/+18
I build gdb with libguile v2.0.9, and ran into: ... In file included from /usr/include/guile/2.0/libguile.h:56, from ../../gdb/guile/guile-internal.h:30, from ../../gdb/guile/scm-arch.c:26: /usr/include/guile/2.0/libguile/inline.h: In function 'int scm_is_pair(SCM)': /usr/include/guile/2.0/libguile/tags.h:97:53: error: \ operation on '*0' may be undefined [-Werror=sequence-point] # define SCM_UNPACK(x) ((scm_t_bits) (0? (*(SCM*)0=(x)): x)) ~~~~~~~~~^~~~~ ... Fix this by using SCM_DEBUG_TYPING_STRICTNESS 0. We were already using this for c++20 due to a Werror=volatile in SCM_UNPACK when using libguile v2.0.10. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com>
2025-01-28Fix gdb.ada/import.exp when using moldTom Tromey4-9/+10
We found that the gdb.ada/import.exp test fails when 'mold' is used as the linker. This happens because mold decides to mark most of the symbols in the executable as being file-local. I tend to think this choice, while non-traditional, is probably fine. So, this patch fixes the problem by changing the relevant Ada code to look for file-local symbols as well. Furthermore, there are two overloads of lookup_minimal_symbol_linkage that both have a final 'bool' parameter -- but with radically different meanings. This patch somewhat clears up this confusion as well. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31378
2025-01-28gdb/remote: add 'binary-upload' feature to guard 'x' packet useAndrew Burgess3-0/+21
This mailing list discussion: https://inbox.sourceware.org/gdb-patches/CAOp6jLYD0g-GUsx7jhO3g8H_4pHkB6dkh51cbyDT-5yMfQwu+A@mail.gmail.com highlighted the following issue with GDB's 'x' packet implementation. Unfortunately, LLDB also has an 'x' packet, but their implementation is different to GDB's and so targets that have implemented LLDB's 'x' packet are incompatible with GDB. The above thread is specifically about the 'rr' tool, but there could be other remote targets out there that have this problem. The difference between LLDB and GDB is that GDB expects a 'b' prefix on the reply data, while LLDB does not. The 'b' is important as it allows GDB to distinguish between an empty reply (which will be a 'b' prefix with no trailing data) and an unsupported packet (which will be a completely empty packet). It is not clear to me how LLDB distinguishes these two cases. See for discussion of the 'x' packet: https://inbox.sourceware.org/gdb-patches/cover.1710343840.git.tankut.baris.aktemur@intel.com/#r with the part specific to the 'b' marker in: https://inbox.sourceware.org/gdb-patches/87msq82ced.fsf@redhat.com/ I propose that we add a new feature 'binary-upload' which can be reported by a stub in its qSupported reply. By default this feature is "off", meaning GDB will not use the 'x' packet unless a stub advertises this feature. I have updated gdbserver to send 'binary-upload+', and when I examine the gdbserver log I can see this feature being sent back, and then GDB will use the 'x' packet. When connecting to an older gdbserver, the feature is not sent, and GDB does not try to use the 'x' packet at all. I also built the latest version of `rr` and tested using current HEAD of master, where I see problems like this: (rr) x/10i main 0x401106 <main>: Cannot access memory at address 0x401106 Then tested using this patched version of GDB, and now I see: (rr) x/10i main 0x401106 <main>: push %rbp 0x401107 <main+1>: mov %rsp,%rbp 0x40110a <main+4>: mov 0x2f17(%rip),%rax # 0x404028 <global_ptr> ... etc ... and looking in the remote log I see GDB is now using the 'm' packet instead of the 'x' packet. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32593 Reviewed-By: Eli Zaretskii <eliz@gnu.org> Reviewed-By: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
2025-01-28gdb/configure: fail configure if all targets requested with 32bit bfdGuinevere Larsen2-2/+6
As PR sim/28684 explains, it isn't possible to compile GDB with all targets enabled and not enabling 64 bit bfd. In 64 bit hosts, 64 bit bfd is forced, so the build works, but in 32 bit hosts, that has to be explicitly enabled. I ran into this when I tried compiling GDB on a mips64 machine running a 32 bit OS. Along with the errors in the PR, several other architectures are also required, notably aarch64 and other explicitly 64bit targets. Additionally, some 32 bit files required for the gdb mips target aren't added to the makefile. Considering the last comment in the bug says this isn't going to be fixed on the binutils side, I didn't think it was worth trying to fix the GDB side. Instead, this commit causes the configure script to fail if all targets were requested and 64 bit bfd isn't enabled. If that is ever fixed, we can revert this commit. I considered adding this to the top level configure script, but couldn't figure out how to detect the situation in there, so this was my next best idea. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28684 Approved-by: Kevin Buettner <kevinb@redhat.com>
2025-01-28[gdb/doc] Fix "Standard Replies" xrefTom de Vries1-1/+1
When building gdb with an older makeinfo (4.13), I run into: ... gdb/doc/gdb.texinfo:42613: warning: `.' or `,' must follow @xref, not `f'. ... This is related to this line: ... @xref{Standard Replies} for standard error responses, and how to respond indicating a command is not supported. ... Fix this by adding a comma. Tested by rebuilding the docs. Reviewed-By: Eli Zaretskii <eliz@gnu.org> Co-Authored-By: Eli Zaretskii <eliz@gnu.org>
2025-01-27[gdb/build] Fix build with gcc 7.5.0Tom de Vries1-0/+5
When building gdb with gcc 7.5.0, I run into: ... gdb/dwarf2/cooked-index.c: In lambda function: gdb/dwarf2/cooked-index.c:104:5: error: \ the value of ‘_sch_tolower’ is not usable in a constant expression }; ^ In file included from gdbsupport/gdb-safe-ctype.h:47:0, from gdb/dwarf2/cooked-index.c:34: include/safe-ctype.h:111:29: note: ‘_sch_tolower’ was not declared ‘constexpr’ extern const unsigned char _sch_tolower[256]; ^~~~~~~~~~~~ ... This does not happen with gcc 8.2.1. Fix this by dropping the constexpr on lambda function munge in cooked_index_entry::compare for gcc 7. Tested by completing the build on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com>
2025-01-27[gdb/doc] Use more lower-case in @sc in the documentationTom de Vries2-2/+2
When building gdb with an older makeinfo (4.13), I run into: ... gdb/doc/gdb.texinfo:49064: warning: @sc argument all uppercase, thus no effect. ... Using a grep, I found one more instance: ... $ grep @sc gdb/doc/*.tex* | egrep -v '@sc{[^A-Z]*}' gdb/doc/gdb.texinfo:\ Bit 1 (@sc{ZA}) shows whether the @code{ZA} register state is active (in use) or gdb/doc/python.texi:\ corresponding @sc{GDB/MI} command's output. Refer to the ... Fix this by using lowercase letters in the @sc argument, similar to how that was done in commit c96452ad168 ("Use lower-case in @sc in the documentation"). Tested by rebuilding the documentation.
2025-01-27[gdb/doc] Fix qIsAddressTagged anchorTom de Vries1-1/+1
When building gdb with an older makeinfo (4.13), I run into: ... gdb/doc/gdb.texinfo:44159: @anchor expected braces. gdb/doc/gdb.texinfo:44159: ` {qIsAddressTagged} ... This is related to this line: ... @anchor {qIsAddressTagged} ... Fix this by removing the space before the left brace. Tested by rebuilding the documentation.
2025-01-27[gdb/doc] Fix gdb.unwinder docsTom de Vries1-2/+2
When building gdb with an older makeinfo (4.13), I run into: ... gdb/doc/python.texi:3015: warning: `(' follows defined name \ `gdb.unwinder.Unwinder.__init__' instead of whitespace. gdb/doc/python.texi:3041: warning: `(' follows defined name \ `gdb.unwinder.FrameId.__init__' instead of whitespace. ... The warnings are related to these two lines: ... @defun gdb.unwinder.Unwinder.__init__(name) ... @defun gdb.unwinder.FrameId.__init__(sp, pc, special = @code{None}) ... Indeed, when checking the command and variable index, we can see that it contains an incorrect entry: ... gdb.unwinder.FrameId.__init__(sp,: Unwinding Frames in Python ... Fix this by adding a space before the left parenthesis. Tested by rebuilding the documentation and checking the command and variable index.
2025-01-27Fix some broken links in docs and commentsYury Khrustalev1-1/+1
Reviewed-By Richard Earnshaw <richard.earnshaw@arm.com>
2025-01-24Fix C++ template function matching in cooked indexTom Tromey4-28/+53
In commit 64a97606 ("Support template lookups in strncmp_iw_with_mode"), gdb was changed so that a command like "break func<templ>" would match instantiations like "func<templ<int>>". The new indexer does not support this and so this is a regression. This went unnoticed because gdb.linespec.cpcompletion.exp puts all these functions into the main file, and this CU is expanded early. This patch fixes the bug by changing the cooked index entry comparison function. It also updates the test to fail without this fix. Regression tested on x86-64 Fedora 40. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32482
2025-01-24gdb/riscv: Add command to switch between numeric & abi register namesCiaran Woodward3-27/+86
In RISC-V, the general registers can be shown in their abi form (e.g. sp, a0) or their numeric form (e.g. x2, x10). Depending on context/preference, someone may prefer to see one form over the other. The disassembler already supports this configuration, which can be changed using the 'set disassembler-options numeric' command. This commit adds a new set/show command to change gdb's preference: 'set riscv numeric-registers-names on/off'. If on, 'info registers' and other situations will print the numeric register names, rather than the abi versions. The alias generation has been modified so that the abi versions are still available for access if specifically requested such as 'print $ra'. This was done by changing the behaviour of the code which adds the aliases: all register names will be added as aliases, even if the name is the primary one. There is also no functional downside to adding aliases which are surplus-to-requirement, since they will be ignored if there is a 'true' register with the same name. Approved-By: Andrew Burgess <aburgess@redhat.com>