aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2023-03-29[gdb/testsuite] Fix gdb.guile/guile.exp for remote hostTom de Vries1-17/+21
Fix test-case gdb.guile/guile.exp for remote host using gdb_remote_download. Tested on x86_64-linux.
2023-03-28Rename "raw" to "unrelocated"Tom Tromey15-61/+63
Per an earlier discussion, this patch renames the existing "raw" APIs to use the word "unrelocated" instead.
2023-03-28Use unrelocated_addr in minimal symbolsTom Tromey18-86/+109
This changes minimal symbols to use unrelocated_addr. I believe this detected a latent bug in add_pe_forwarded_sym.
2023-03-28Use unrelocated_addr in psymbolsTom Tromey7-45/+93
This changes psymbols themselves to use unrelocated_addr. This transform is largely mechanical. I don't think it finds any bugs.
2023-03-28Use unrelocated_addr in partial symbol tablesTom Tromey7-69/+89
This changes partial symbol tables to use unrelocated_addr for the text_high and text_low members. This revealed some latent bugs in ctfread.c, which are fixed here.
2023-03-28Move definition of unrelocated_addr earlierTom Tromey1-6/+6
This moves the definition of unrelocated_addr a bit earlier in symtab.h, so that it can be used elsewhere in the file.
2023-03-28Use function_view in gdb_bfd_lookup_symbolTom Tromey5-57/+40
This changes gdb_bfd_lookup_symbol to use a function_view. This simplifies the code a little bit.
2023-03-28[gdb/testsuite] Fix gdb.btrace/multi-inferior.exp for remote hostTom de Vries1-2/+4
Fix test-case gdb.btrace/multi-inferior.exp for remote host using gdb_remote_download. Tested on x86_64-linux.
2023-03-28[gdb/testsuite] Fix gdb.btrace/gcore.exp for remote hostTom de Vries1-1/+1
Fix test-case gdb.btrace/gcore.exp for remote host using host_standard_output. Tested on x86_64-linux.
2023-03-28[gdb/testsuite] Fix gdb.btrace/reconnect.exp for remote targetTom de Vries1-1/+3
Fix test-case gdb.btrace/reconnect.exp for target board remote-gdbserver-on-localhost using gdb_remote_download. Tested on x86_64-linux.
2023-03-28Put pretty-printers to_string output in varobj resultTom Tromey4-35/+26
PR mi/11335 points out that an MI varobj will not display the result of a pretty-printer's "to_string" method. Instead, it always shows "{...}". This does not seem very useful, and there have been multiple complaints about it over the years. This patch changes varobj to emit this string when possible, and updates the test suite. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=11335
2023-03-28gdb/testsuite: allow "require" callbacks to provide a reasonSimon Marchi2-12/+33
When an allow_* proc returns false, it can be a bit difficult what check failed exactly, if the procedure does multiple checks. To make investigation easier, I propose to allow the "require" callbacks to be able to return a list of two elements: the zero/non-zero value, and a reason string. Use the new feature in allow_hipcc_tests to demonstrate it (it's also where I hit actually hit this inconvenience). On my computer (where GDB is built with amd-dbgapi support but where I don't have a suitable GPU target), I get: UNSUPPORTED: gdb.rocm/simple.exp: require failed: allow_hipcc_tests (no suitable amdgpu targets found) vs before: UNSUPPORTED: gdb.rocm/simple.exp: require failed: allow_hipcc_tests Change-Id: Id1966535b87acfcbe9eac99f49dc1196398c6578 Approved-By: Tom de Vries <tdevries@suse.de>
2023-03-28[gdb/testsuite] Fix gdb.server/server-kill-python.exp for remote hostTom de Vries1-1/+5
Fix test-case gdb.server/server-kill-python.exp for remote host using gdb_remote_download. Tested on x86_64-linux.
2023-03-28[gdb/testsuite] Fix gdb.server/sysroot.exp for remote hostTom de Vries1-2/+7
Fix test-case gdb.server/sysroot.exp for remote host, by: - using gdb_remote_download, and - disabling the "local" scenario for remote host/target, unless remote host == remote target. Tested on x86_64-linux.
2023-03-28[gdb/testsuite] Require non-remote host for gdb.server/multi-ui-errors.expTom de Vries1-0/+3
Require non-remote host for test-case gdb.server/multi-ui-errors.exp, because it uses "spawn -pty", which creates a pty on build, which gdb cannot use on remote host. Tested on x86_64-linux.
2023-03-28[gdb/testsuite] Fix gdb.server/solib-list.exp for remote hostTom de Vries2-5/+7
Fix test-case gdb.server/solib-list.exp for remote host using gdb_remote_download. Likewise in another test-case. Tested on x86_64-linux.
2023-03-28[gdb/testsuite] Fix gdb.server/file-transfer.exp for remote hostTom de Vries1-6/+6
Fix test-case gdb.server/file-transfer.exp for remote host using gdb_remote_download and host_standard_output_file. Tested on x86_64-linux.
2023-03-28[gdb/testsuite] Fix local-remote-host-native.exp for gdb.server testsTom de Vries1-1/+5
When running test-case gdb.server/stop-reply-no-thread-multi.exp with host+target board local-remote-host-native, I run into a time-out: ... (gdb) PASS: gdb.server/stop-reply-no-thread-multi.exp: target-non-stop=off: \ to_disable=: disconnect builtin_spawn /usr/bin/ssh -t -l vries 127.0.0.1 gdbserver --once \ localhost:2346 stop-reply-no-thread-multi^M Process stop-reply-no-thread-multi created; pid = 32600^M Listening on port 2346^M set remote threads-packet off^M FAIL: gdb.server/stop-reply-no-thread-multi.exp: target-non-stop=off: \ to_disable=: set remote threads-packet off (timeout) ... This is due to this line in ${board}_spawn: ... set board_info($board,fileid) $spawn_id ... We have the following series of events: - gdb is spawned, setting fileid - a few gdb commands (set height etc) are send using fileid, arrive at gdb and are successful - gdbserver is spawned, overwriting fileid - the next gdb command is sent using fileid, so it's send to gdbserver instead of gdb, and we run into the timeout. There is some notion of current gdb, tracked in both gdb_spawn_id and fileid of the host board (see switch_gdb_spawn_id). And because the host and target board are the same, spawning something on the target overwrites the fileid on host, and consequently the current gdb. Fix this by only setting fileid when spawning gdb. Tested on x86_64-linux. Now gdb.server/*.exp passes for host+target board local-remote-host-native, except for file-transfer.exp. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29734
2023-03-28gdb: use dynamic year in update-freebsd.shEnze Li1-1/+3
When running update-freebsd.sh on FreeBSD, I see the following modification in freebsd.xml, -<!-- Copyright (C) 2009-2023 Free Software Foundation, Inc. +<!-- Copyright (C) 2009-2020 Free Software Foundation, Inc. It means that each time, when we running the update-freebsd.sh on FreeBSD, we have to correct the year of copyright manually. So fix this issue by using dynamic year. Tested by regenerating freebsd.xml on FreeBSD/amd64. Reviewed-By: John Baldwin <jhb@FreeBSD.org> Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-03-28[gdb/testsuite] Fix gdb.server/non-existing-program.exp with ↵Tom de Vries1-3/+3
remote-gdbserver-on-localhost With test-case gdb.server/non-existing-program.exp and native, I have reliably: ... (gdb) builtin_spawn gdbserver stdio non-existing-program^M stdin/stdout redirected^M /bin/bash: line 0: exec: non-existing-program: not found^M During startup program exited with code 127.^M Exiting^M PASS: gdb.server/non-existing-program.exp: gdbserver exits cleanly ... But with target board remote-gdbserver-on-localhost I sometimes have: ... (gdb) builtin_spawn /usr/bin/ssh -t -l remote-target localhost gdbserver \ stdio non-existing-program^M stdin/stdout redirected^M /bin/bash: line 0: exec: non-existing-program: not found^M During startup program exited with code 127.^M Exiting^M Connection to localhost closed.^M^M PASS: gdb.server/non-existing-program.exp: gdbserver exits cleanly ... and sometimes the exact same output, but a FAIL instead. Fix this by replacing "Exiting\r\n$" with "Exiting\r\n" in the regexps. Tested on x86_64-linux.
2023-03-28[gdb/testsuite] Allow gdb.rust/expr.exp without rust compilerTom de Vries20-4/+19
Proc allow_rust_tests returns 0 when there's no rust compiler, but that gives the wrong answer for gdb.rust/expr.exp, which doesn't require it. Fix this by using can_compile rust in the test-cases that need it, and just returning 1 in allow_rust_tests. Tested on x86_64-linux.
2023-03-28[gdb/testsuite] Add can_compile rustTom de Vries1-23/+42
If I deinstall the rust compiler, I get: ... gdb compile failed, default_target_compile: Can't find rustc --color never. UNTESTED: gdb.rust/watch.exp: failed to prepare ... Fix this by adding can_compile rust, and using it in allow_rust_tests, such that we have instead: ... UNSUPPORTED: gdb.rust/watch.exp: require failed: allow_rust_tests ... Since the rest of the code in allow_rust_tests is also about availability of the rust compiler, move it to can_compile. Tested on x86_64-linux.
2023-03-28[gdb/testsuite] Unsupport gdb.rust for remote hostTom de Vries1-0/+5
With test-case gdb.rust/watch.exp and remote host I run into: ... Executing on host: gcc watch.rs -g -lm -o watch (timeout = 300) ... ld:watch.rs: file format not recognized; treating as linker script ld:watch.rs:1: syntax error ... UNTESTED: gdb.rust/watch.exp: failed to prepare ... The problem is that find_rustc returns "" for remote host, so we fall back to gcc, which fails. Fix this by returning 0 in allow_rust_tests for remote host. Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Fix gnat_runtime_has_debug_info for remote hostTom de Vries1-0/+4
Fix gnat_runtime_has_debug_info for remote host by checking for allow_ada_tests. This fixes an error for test-case gdb.testsuite/gdb-caching-proc.exp and remote host. Tested on x86_64-linux.
2023-03-27fbsd-nat: Use correct constant for target_waitstatus::sig.John Baldwin1-1/+1
Use GDB_SIGNAL_TRAP instead of SIGTRAP. This is a no-op since the value of SIGTRAP on FreeBSD matches the value of GDB_SIGNAL_TRAP, but it is more correct. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-03-27fbsd-nat: Avoid a direct write to target_waitstatus::kind.John Baldwin1-1/+1
This is in #ifdef'd code for a workaround for FreeBSD versions older than 11.1 which is why it wasn't caught earlier. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-03-27fbsd-nat: Add missing spaces.John Baldwin1-11/+11
No functional change, just style fixes. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-03-27linux-nat: introduce pending_status_strPedro Alves2-7/+23
I noticed that some debug log output printing an lwp's pending status wasn't considering lp->waitstatus. This fixes it, by introducing a new pending_status_str function. Also fix the comment in gdb/linux-nat.h describing lwp_info::waitstatus and details the description of lwp_info::status while at it. Change-Id: I66e5c7a363d30a925b093b195d72925ce5b6b980 Approved-By: Andrew Burgess <aburgess@redhat.com>
2023-03-27displaced step: pass down target_waitstatus instead of gdb_signalPedro Alves9-26/+30
This commit tweaks displaced_step_finish & friends to pass down a target_waitstatus instead of a gdb_signal. This is needed because a patch later in the step-over-{thread-exit,clone] series will want to make displaced_step_buffers::finish handle TARGET_WAITKIND_THREAD_EXITED. It also helps with the TARGET_WAITKIND_THREAD_CLONED patch later in that same series. It's also a bit more logical this way, as we don't have to pass down signals when the thread didn't actually stop for a signal. So we can also think of it as a clean up. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27338 Change-Id: I4c5d338647b028071bc498c4e47063795a2db4c0 Approved-By: Andrew Burgess <aburgess@redhat.com>
2023-03-27[gdb/testsuite] Fix gdb.stabs/exclfwd.exp for remote hostTom de Vries1-0/+2
Fix test-case gdb.stabs/exclfwd.exp for remote host using include_file. Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Fix gdb.stabs/weird.exp for remote hostTom de Vries1-4/+3
Fix test-case gdb.stabs/weird.exp for remote host by not using an absolute destfile argument to gdb_remote_download, which doesn't work well with remotedir.
2023-03-27[gdb/testsuite] Fix gdb.gdb/unittest.exp for remote hostTom de Vries1-31/+44
Fix test-case gdb.gdb/unittest.exp for remote host, by: - disabling the completion tests if readline is not used, and - not using with_gdb_cwd $dir for remote host (because it does not support changing to "."). Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Skip do_self_tests on remote hostTom de Vries1-1/+1
In do_self_tests we try to find out the location of the gdb to debug, which will then be copied and renamed to xgdb. In principle, the host board specifies the location of GDB, on host. With remote host, we could upload that gdb from host to build/target, but we would miss the data directory (which is listed as the reason to skip do_self_tests for remote target). We could fix that by instead taking the gdb from build instead, but that wouldn't work with installed testing. It seems easier to just skip this on remote host. It could be made to work for the "[is_remote host] && [is_remote target] && host == target" scenario (see board local-remote-host-native.exp), but that doesn't seem worth the effort. Tested on x86_64-linux.
2023-03-27Change symbol::line to unsigned intTom Tromey5-11/+58
A user here at AdaCore noticed that, when debugging a certain program, a stack frame reported line 34358, where it should have been line 99894. After debugging a bit, I discovered: (top) p (99894 & ~65536) $60 = 34358 That line, symbol::line is too narrow. This patch widens the member and changes all the uses that currently use the narrower type. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-03-27Fix 128-bit integer bug in AdaTom Tromey3-21/+63
While working on 128-bit integer support, I found one spot in Ada that needed a fix as well.
2023-03-27Use gdb_gmp for scalar arithmeticTom Tromey7-367/+247
This changes gdb to use scalar arithmetic for expression evaluation. I suspect this patch is not truly complete, as there may be code paths that still don't correctly handle 128-bit integers. However, many things do work now. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30190
2023-03-27Use value_true in value_equal and value_lessTom Tromey1-4/+2
Both value_equal and value_less use value_as_long to check a presumably boolean result of calling value_binop. However, value_binop in this case actually returns an int as wide as its arguments, and this approach can then fail for integers wider than LONGEST. Instead, rewrite this in a form that works for any size integer.
2023-03-27Simplify binop_promoteTom Tromey1-36/+19
binop_promote currently only handles integer sizes up to builtin_long_long. However, this may not handle 128-bit types. Simplify this code, unify the C and non-C (but not OpenCL, as I don't know how to test this) cases, and handle 128-bit integers as well. This still doesn't exactly follow C or C++ rules. This could be implemented, but if so, I think it makes more sense as a C-specific expression node.
2023-03-27Add value_as_mpz and value_from_mpzTom Tromey2-0/+113
This adds the two new functions, value_as_mpz and value_from_mpz, useful for manipulation values via gdb_mpz.
2023-03-27Add truncation mode to gdb_mpzTom Tromey2-46/+76
This renames gdb_mpz::safe_export to export_bits, and adds a new flag to export a truncated value. This is needed by value arithmetic.
2023-03-27Avoid a copy in gdb_mpz::safe_exportTom Tromey1-9/+9
Currently, gdb_mpz::safe_export will always make a copy of *this. However, this copy isn't always needed. This patch makes this code slightly more efficient, by avoiding the copy when possible.
2023-03-27Add many operators to gdb_mpzTom Tromey1-0/+138
This adds many operator overloads and other useful methods to gdb_mpz. This is preparation for using this class for scalar arithmetic in gdb expression evaluation.
2023-03-27Populate seen_names hash in cooked_index_shard::do_finalizeTom Tromey1-0/+1
Hannes pointed out that cooked_index_shard::do_finalize never populates the seen_names hash table. This patch adds the necessary store. This reduces memory use a little for "gdb gdb": (before) Space used: 28909568 (+0 for this command) (after) Space used: 28884992 (+0 for this command) What this means, btw, is that in gdb there are not many symbols that are both mentioned in many CUs and that also require name canonicalization. It's possible this would differ in other programs.
2023-03-27[gdb/testsuite] Fix gdb.asm/asm-source.exp for remote hostTom de Vries1-4/+8
Fix test-case gdb.asm/asm-source.exp for remote host using host_standard_output_file and gdb_remote_download. Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Fix gdb.dwarf2/imported-unit-bp-c.exp for remote hostTom de Vries1-0/+5
Fix test-case gdb.dwarf2/imported-unit-bp-c.exp on remote by removing a downloaded source file. Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Unsupport gdb.dwarf2/gdb-add-index-symlink.exp for remote hostTom de Vries1-0/+3
Declare test-case gdb.dwarf2/gdb-add-index-symlink.exp unsupported for remote host, because the current implementation of gdb_ensure_index doesn't support it. Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Fix gdb.dwarf2/gdb-index-cxx.exp for remote hostTom de Vries2-1/+4
Fix test-case gdb.dwarf2/gdb-index-cxx.exp for remote host using host_standard_output_file. Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Fix gdb.dwarf2/enqueued-cu-base-addr.exp for remote hostTom de Vries1-1/+1
Fix test-case gdb.dwarf2/enqueued-cu-base-addr.exp for remote host by using $testfile instead $binfile. Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Fix gdb.dwarf2/gdb-index.exp on remote hostTom de Vries2-11/+32
Fix test-case gdb.dwarf2/gdb-index.exp on remote host using gdb_remote_download and host_standard_output_file. Also declare the test-case unsupported with readnow. Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Fix gdb.dwarf2/per-bfd-sharing.exp for remote hostTom de Vries6-21/+23
Fix test-case gdb.dwarf2/per-bfd-sharing.exp for remote host using gdb_remote_download. Likewise in a few other test-cases. Tested on x86_64-linux.