Age | Commit message (Collapse) | Author | Files | Lines |
|
In an earlier patch, I wrote:
... It also adds some machinery so that attach stops can be
suppressed, which I think is the right thing to do.
However, after some discussions here at AdaCore, I now believe this to
be incorrect -- while DAP says that expected "continue" events should
be suppressed, there is no corresponding language for expected "stop"
events, and indeed "stop" events explicitly mention cases like "step".
This patch arranges for the stop event to be emitted again.
|
|
A user found that gdb would not correctly print a field from an Ada
record using the scalar storage order feature. We tracked this down
to a combination of problems.
First, GCC did not emit DW_AT_endianity on the enumeration type.
DWARF does not specify this, but it is an obvious and harmless
extension. This was fixed in GCC recently:
https://gcc.gnu.org/pipermail/gcc-patches/2024-January/642347.html
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=5d8b60effc7268448a94fbbbad923ab6871252cd
Second, GDB did not handle this attribute on enumeration types. This
patch makes this change and adds a test case that will pass with the
patched GCC.
So far, the GCC patch isn't on the gcc-13 branch; but if it ever goes
in, the test case in this patch can be updated to reflect that.
Reviewed-By: Keith Seitz <keiths@redhat.com>
|
|
arm_epilogue_frame_this_id has a comment saying that it fall backs to using
the current PC if the function start address can't be identified, but it
actually uses only the PC to make the frame id.
This patch makes the code match the comment. Another hint that it's what
is intended is that arm_prologue_this_id, a function almost identical to
it, does that.
The problem was found by code inspection. It fixes the following testsuite
failures:
FAIL: gdb.base/unwind-on-each-insn.exp: foo: instruction 9: check frame-id matches
FAIL: gdb.reverse/solib-reverse.exp: reverse-next third shr1
FAIL: gdb.reverse/solib-reverse.exp: reverse-next second shr1
FAIL: gdb.reverse/solib-reverse.exp: reverse-next first shr1
FAIL: gdb.reverse/solib-reverse.exp: reverse-next generic
FAIL: gdb.reverse/solib-reverse.exp: reverse-step into solib function one
FAIL: gdb.reverse/solib-reverse.exp: reverse-step within solib function one
FAIL: gdb.reverse/solib-reverse.exp: reverse-step into solib function two
FAIL: gdb.reverse/solib-reverse.exp: reverse-step within solib function two
Tested on arm-linux-gnueabi-hf.
|
|
This patch is based on an out-of-tree patch that fedora has been
carrying for a while. It tests if GDB is able to properly unwind a
threaded program in the following situations:
* regular threads
* in a signal handler
* in a signal handler executing on an alternate stack
And the final frame can either be in a syscall or in an infinite loop.
The test works by running the inferior until a crash to generate a
corefile, or until right before the crash. Then applies a backtrace to
all threads to see if any frame can't be identified, and the order of
the threads in GDB. Finally, it goes thread by thread and tries to
collect a large part of the backtrace, to confirm that everything is
being unwound correctly.
Co-Authored-By: Andrew Burgess <aburgess@redhat.com>
Reviewed-By: Luis Machado <luis.machado@arm.com>
Approved-By: Luis Machado <luis.machado@arm.com>
|
|
When a user attempts to use the "list ." command with an inferior that
doesn't have debug symbols, GDB would crash. This was reported as PR
gdb/31256.
The crash would happen when attempting to get the current symtab_and_line
for the stop location, because the symtab would return a null pointer
and we'd attempt to dereference it to print the line.
This commit fixes that by checking for an empty symtab and erroring out
of the function if it happens.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31256
Approved-By: Tom Tromey <tom@tromey.com>
|
|
(and more)
Tom Tromey noticed that dw2-zero-range.exp reported a duplicate test
name. This happens because have_index calls get_index_type with the
default test name. Refactor the test to avoid this, while cleaning a
few other things, the most important being:
- factor out the relocated and unrelocated parts in their own procs
- give different names to generated binaries in different variations,
such that all binaries are left in the test output directory (this
makes it easier to debug a specific variation)
Change-Id: I7cdf7a344834852fbb035d7e0434559eab6b1e94
|
|
A user pointed out that gdb will print a Python exception when it gets
an EOF in DAP mode. And, it turns out that an EOF like this also
causes gdb not to exit. This is due to the refactoring that moved the
JSON reader to its own thread -- previously this caused an exception
to propagate and cause an exit, but now it just leaves the reader
hung.
This patch fixes these problems by arranging to handle EOF more
gracefully.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31217
|
|
In one spot, DW_OP_GNU_push_tls_address is handled differently from
DW_OP_form_tls_address. However, I think they should always be
treated identically.
Approved-by: Kevin Buettner <kevinb@redhat.com>
|
|
The test gdb.btrace/tailcall.exp has multiple tests that include the
filename in the output. When testing with gcc, only a relative path is
printed, but when using clang, the full file path is printed instead.
This makes most of those tests fail, with the exception of "record goto
4" which allows for more characters before the file name. The test
gdb.btrace/recod_goto.exp suffers with the same issue
This commit allows for text before the filename. However, instead of how
the aforementioned "record goto 4", it uses a regexp that doesn't allow
for newlines, just in case some off output happens.
Approved-By: Tom Tromey <tom@tromey.com>
|
|
The test gdb.dwarf2/dw2-noloc.exp predates the dwarf assembler, and uses
some unreliable assumptions about where global labels get put.
Specifically, when using clang to compile the test, both labels it uses
to gauge the adresses of the main function get reshuffled to be side-by-side,
and the debug information ends up making it look like main's high pc is equal
to low pc, meaning we never enter the main function's scope, and that leads to
22 failures because the "main_*" variables are technically never in scope.
This patch modernizes the aforementioned test to use the dwarf
assembler, which removes all failures when using clang. It also renames
the .c file to be more inline with current standard.
Approved-By: Tom Tromey <tom@tromey.com>
|
|
A recent(ish) change in gdb/infrun.c made process_event_stop_test load
debug information where it would not have done so previously. The
change is:
commit bf2813aff8f2988ad3d53e819a0415abf295c91f
AuthorDate: Fri Sep 1 13:47:32 2023 +0200
CommitDate: Mon Nov 20 10:54:03 2023 +0100
gdb/record: print frame information when exiting a recursive call
Currently, when GDB is reverse stepping out of a function into the same
function due to a recursive call, it doesn't print frame information, as
reported by PR record/29178. This happens because when the inferior
leaves the current frame, GDB decides to refresh the step information,
clobbering the original step_frame_id, making it impossible to figure
out later on that the frame has been changed.
This commit changes GDB so that, if we notice we're in this exact
situation, we won't refresh the step information.
Because of implementation details, this change can cause some debug
information to be read when it normally wouldn't before, which showed up
as a regression on gdb.dwarf2/dw2-out-of-range-end-of-seq. Since that
isn't a problem, the test was changed to allow for the new output.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29178
Although there is nothing wrong with this change in principle, it
happens to break most of the tests in gdb/testsuite/gdb.rocm/*.exp.
This is because those tests do rely on GDB not loading debug
information. This is necessary because the debug information produced
for AMDGPU code is using DWARF extensions which are not supported by GDB
at this point.
In this patch, I propose to use a lazy loading mechanism so the frame_id
for the current frame is only computed when required instead of when
entering process_event_stop_test. The lazy_loader class is currently
defined locally in infrun.c, but if it turns out to be useful elsewhere,
it could go somewhere under gdbsupport.
This patch should restore the behavior GDB had before
bf2813aff8f2988ad3d53e819a0415abf295c91f when it comes to load debug
info.
Another approach could have been to revert
fb84fbf8a51f5be2e78765508ebd9753af96b492 (gdb/infrun: simplify
process_event_stop_test) and adjust the implementation of
bf2813aff8f2988ad3d53e819a0415abf295c91f (gdb/record: print frame
information when exiting a recursive call). However, I think that the
lazy loading works well with the simplification done recently, so I went
down that route.
Regression tested on x86_64-linux (Ubuntu 22.04) with AMDGPU support.
Change-Id: Ib63a162128130d1786a77c98623e9e3dcbc363b7
Approved-by: Kevin Buettner <kevinb@redhat.com>
|
|
Remove SYMBOL_BLOCK_OPS, SYMBOL_COMPUTED_OPS and SYMBOL_REGISTER_OPS, in
favor of methods on struct symbol. More changes could be done here to
improve the design and make things safer, but I just wanted to do a
straightforward change to remove the macros for now.
Change-Id: I27adb74a28ea3c0dc9a85c2953413437cd95ad21
Reviewed-by: Kevin Buettner <kevinb@redhat.com>
|
|
In the past, dwarf2_per_cu_data was allocated using malloc, so special
handling was needed for the vector used for symtab handling. We
changed this to use 'new' a while back, so this code can now be
greatly simplified.
Regression tested on x86-64 Fedora 38.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This commit removes deprecated_exec_file_display_hook and the
associated specify_exec_file_hook.
The specify_exec_file_hook is used to add a new hook function to
deprecated_exec_file_display_hook, but is only used from the insight
debugger.
I posted a patch to remove the use of specify_exec_file_hook from
insight, and instead use gdb::observers::executable_changed, this
patch can be found here (it has now been merged):
https://inbox.sourceware.org/insight/6abeb45e97d9004ec331e94cf2089af00553de76.1702379379.git.aburgess@redhat.com/T/#u
With this merged we can now cleanup the GDB side as this code is now
unused.
There should be no user visible changes after this commit.
Approved-By: Tom Tromey <tom@tromey.com>
|
|
After closing "Bug 30770 - serial.c does not preserve errno correctly"
https://sourceware.org/bugzilla/show_bug.cgi?id=30770
remote debugging became impossible due to an attempt to recv() by a call intended for the socket, and not for the character device file. The
documentation implicitly states that it is possible to use the read() call to work with a socket. But this does not mean in the general case that it is
permissible to use recv in the case of a non-socket.
condition:
os: Distributor ID: Ubuntu
Description: Ubuntu 23.10
Release: 23.10
Codename: mantic
libc:
ldd (Ubuntu GLIBC 2.38-1ubuntu6) 2.38
kernel:
Linux klen-dev-um790pro 6.5.0-14-generic #14-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 14 14:59:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
gdb: build from trank at 15.0.50.20231226-git
GDB output:
$ arm-kgp-eabi-gdb
GNU gdb (Klen's_GNU_package_(KGP)_for_target::arm-kgp-eabi<rmprofile/lto>_host::x86_64-kgp-linux-gnu_znver4-avx512<<ílex>>)
15.0.50.20231226-git
....
(gdb) tar ext /dev/ttyACM1
Remote debugging using /dev/ttyACM1
Remote communication error. Target disconnected: error while reading: Socket operation on non-socket.
(gdb)
after fix gdb work fine
$ arm-kgp-eabi-gdb -q
(gdb) tar ext /dev/ttyACM0
Remote debugging using /dev/ttyACM0
(gdb) mon swd
Target voltage: 0.0V
Available Targets:
No. Att Driver
STM32F40x M4
(gdb) att 1
Attaching to Remote target
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
0x08020c80 in ?? ()
(gdb)
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30770
|
|
Replace throw with throw_exeception in do_with_buffered_output.
This patch fixes regressions in gdb.dwarf2/dw2-dir-file-name.exp
caused by commit 519d63439.
do_with_buffered_output needs to use throw_exception instead of
throw to ensure that exceptions of the correct type are thrown.
If using throw, gdb_exception_error may be wrongly converted into
gdb_exception during print_frame_info. This prevents the exception
from being caught in print_stack_frame.
|
|
With test-case gdb.threads/attach-many-short-lived-threads.exp, I run into:
...
(gdb) attach 7773^M
Attaching to program: attach-many-short-lived-threads, process 7773^M
Cannot attach to lwp 7776: Operation not permitted (1)^M
(gdb) PASS: $exp: iter 1: attach
info threads^M
No threads.^M
(gdb) PASS: $exp: iter 1: no new threads
set breakpoint always-inserted on^M
(gdb) PASS: $exp: iter 1: set breakpoint always-inserted on
break break_fn^M
Breakpoint 1 at 0x400b4d: file attach-many-short-lived-threads.c, line 57.^M
(gdb) PASS: $exp: iter 1: break break_fn
continue^M
The program is not being run.^M
(gdb) FAIL: $exp: iter 1: break at break_fn: 1 \
(the program is no longer running)
...
There's some code in the test-case dealing with a similar warning:
...
-re "warning: Cannot attach to lwp $decimal: Operation not permitted" {
...
But since commit c6f7f9c80c3 ("Bail out of "attach" if a thread cannot be
traced"), the warning has been changed into an error.
Fix the FAIL by updating the test-case to expect an error instead of a
warning.
Tested on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
|
|
value_from_register can't return nullptr, remove some NULL checks.
Change-Id: Ia6b32b8f86e593c535e3678a89dffe5544eb7ab0
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Introduce new ui_file buffering_file to temporarily collect output
written to gdb_std* output streams during print_thread, print_frame_info
and print_stop_event.
This ensures that output during these functions is not interrupted
by debuginfod progress messages.
With the addition of deferred debuginfo downloading it is possible
for download progress messages to print during these events.
Without any intervention we can end up with poorly formatted output:
(gdb) backtrace
[...]
#8 0x00007fbe8af7d7cf in pygi_invoke_c_callable (Downloading separate debug info for /lib64/libpython3.11.so.1.0
function_cache=0x561221b224d0, state=<optimized out>...
To fix this we buffer writes to gdb_std* output streams while allowing
debuginfod progress messages to skip the buffers and print to the
underlying output streams immediately. Buffered output is then written
to the output streams. This ensures that progress messages print first,
followed by uninterrupted frame/thread/stop info:
(gdb) backtrace
[...]
Downloading separate debug info for /lib64/libpython3.11.so.1.0
#8 0x00007fbe8af7d7cf in pygi_invoke_c_callable (function_cache=0x561221b224d0, state=<optimized out>...
Co-Authored-By: Andrew Burgess <aburgess@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
|
|
This rewrites GDB's .debug_names writer. It is now closer to the form
imagined in the DWARF spec. In particular, names are emitted exactly
as they appear in the original DWARF.
In order to make the reader work nicely, some extensions were needed.
These were all documented in an earlier patch. Note that in
particular this writer solves the "main name" problem by putting a
flag into the table.
GDB does not use the .debug_names hash table, so it also does not
write one. I consider this hash table to be essentially useless in
general, due to the name canonicalization problem -- while DWARF says
that writers should use the system demangling style, (1) this style
varies across systems, so it can't truly be relied on; and (2) at
least GCC and one other compiler don't actually follow this part of
the spec anyway.
It's important to note, though, that even if the hash was somehow
useful, GDB probably still would not use it -- a sorted list of names
is needed for completion and performs reasonably well for other
lookups, so a hash table is just overhead, IMO.
String emission is also simplified. There's no need in this writer to
ingest the contents of .debug_str.
A couple of tests are updated to reflect the fact that they now "fail"
because the tests don't include .debug_aranges in the .S file.
Arguably the .debug_names writer should also create this section; but
I did not implement that in this series, and there is a separate bug
about it.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24820
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24549
|
|
I don't know why gdb had the .debug_names augmentation string in two
separate places; this patch exports it in one spot, to be used in
another.
|
|
This rewrites the .debug_names reader to follow the spec.
Since it was first written, gdb's .debug_names writer has been
incorrect -- while the form of the section has been ok, the contents
have been very gdb-specific.
This patch fixes the reader side of this equation, rewriting the
reader to create a cooked index internally -- an important detail
because it allows for the deletion of a lot of code, and it means the
various readers will agree more often.
This reader checks for a new augmentation string. For the time being,
all other producers are ignored -- the old GDB ones because they are
wrong, and clang because it does not emit DW_IDX_parent. (If there
are any other producers, I'm unaware of them.)
While the new reader mostly runs in a worker thread, it does not try
to distribute its work. This could be done by partitioning the name
table. The parent computations could also be done in parallel after
all names have been read. I haven't attempted this.
Note that this patch temporarily regresses gdb.base/gdb-index-err.exp.
This test writes an index using gdb -- but at this particular stage,
gdb cannot read the indexes it creates. Rather than merge the patches
into a mega-patch, I've chosen to just accept this temporary
regression.
In v1 of this patch, I made the new reader more strict about requiring
.debug_aranges. In v2, I've backed this out and kept the previous
logic. This solved a few test failures, though it's arguably not the
right approach.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=25950
|
|
DW_TAG_entry_point is implemented by adding a new LOC_BLOCK symbol --
that is, another function symbol. However, the test case assumes that
"bt" will never pick this symbol.
This assumption seems unwarranted to me, and in fact this test will
regress with the debug-names target board after the .debug_names
rewrite.
This patch changes the test to allow either answer in the backtrace.
If only the main entry point is desired, then it seems that more work
must be done to handle DW_TAG_entry_point properly, as nothing
currently guarantees this property.
|
|
These .debug_names tests were hand-written to mimic clang. However,
they are difficult to update, and in any case the new reader won't
accept clang-generated indices. Therefore this patch removes these
tests.
|
|
dw2-inline-with-lexical-scope.exp relies on the main CU being
expanded. However, it doesn't guarantee that this actually happens,
and with the new .debug_names reader, it won't, because the "main"
program will be found in the index without requiring CU expansion.
This patch fixes the problem by explicitly expanding the CU in
question.
Note that this is an artificial bug -- it occurs because the generated
.debug_aranges isn't correct.
|
|
dw2-zero-range.exp looks for a certain complaint, but this won't be
issued when an index is in use. This patch changes the test to not
fail in this case.
|
|
The handling of an empty hash table in the .debug_names reader is
slightly wrong.
Currently the code assumes there is always an array of hashes.
However, section 6.1.1.4.5 Hash Lookup Table says:
The optional hash lookup table immediately follows the list of
type signatures.
and then:
The hash lookup table is actually two separate arrays: an array of
buckets, followed immediately by an array of hashes.
My reading of this is that the hash table as a whole is optional, and
so the hashes will not exist in this case. (This also makes sense
because the hashes are not useful without the buckets anyway.)
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=25950
|
|
I noticed that cooked_index_worker::start_reading isn't really needed.
This patch removes it, and also removes the SCOPED_EXIT, in favor of a
direct call.
|
|
This changes cooked_index_worker to be an abstract base class. The
base class implementation is moved to cooked-index.c, and a concrete
subclass is added to read.c.
This change is preparation for the new .debug_names reader, which will
supply its own concrete implementation of the worker.
|
|
The new .debug_names reader will work by creating a cooked index from
.debug_names. This patch updates cooked_index::maybe_write_index to
avoid writing the index in this case.
However, in order to do this in a clean way, the readers are changed
so that a nullptr result from index_for_writing means "cannot be
done", and then the error message is moved into write_dwarf_index
(where it historically lived).
|
|
This moves the declaration of cooked_index_functions to
cooked-index.h. This makes it visible for use by the rewritten
.debug_names reader, and it also lets us move the implementation of
make_quick_functions into cooked-index.c, where it really belongs.
|
|
This adds a new 'lang' member to cooked_index_entry. This holds the
language of the symbol. This is primarily useful for the new
.debug_names reader, which will not scan the CUs for languages up
front.
This also changes cooked_index_shard::add to return a non-const
pointer. This doesn't impact the current code, but is needed for the
new reader.
|
|
GDB's new .debug_names implementation uses some extensions. This
patch adds some documentation on this to the manual.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
|
|
I noticed that cooked_index_flag::IS_ENUM_CLASS is not needed. This
patch removes it.
|
|
While working on the previous patch, I saw that the handling of
quick-function installation could be unified
dwarf2_initialize_objfile. In particular, at the end of the function,
if there is an index table, then it can be used to create the quick
function object.
This cleanup will be useful when rewriting the .debug_names reader.
|
|
The new .debug_names reader will reuse the background reading
infrastructure of the cooked index code. In order to share the
handling of 'maint set dwarf synchronous' -- and to avoid having to
export this global -- this patch refactors this to be handled directly
in dwarf2_initialize_objfile.
|
|
Once in a while I'm looking at the gdb.log of an entire testsuite run, and I'm
trying to establish what glibc version is used. Sometimes this is possible,
sometimes not.
Make this easy by calling ldd --version in test-case
gdb.testsuite/dump-system-info.exp, which for instance on openSUSE Leap 15.4
gives:
...
$ ldd --version
ldd (GNU libc) 2.31
...
$
...
Tested on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
|
|
I got a report of a failure from Linaro's CI testing for the test
gdb.base/startup-with-shell.exp.
Looking at the log I see this:
(gdb) PASS: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args = *.unique-extension: inferior started
print argv[1]
$1 = 0xfffed978 "/home/tcwg-build/workspace/tcwg_gnu_4/abe/builds/armv8l-unknown-linux-gnueabihf/armv8l-unknown-linux-gnueabihf/gdb-gdb.git~master/gdb/testsuite/outputs/gdb.base/startup-with-shell/unique-file.unique-e"...
(gdb) FAIL: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args = *.unique-extension: first argument expanded
Notice that the value of $1 was truncated (indicated by the trailing
ellipses), and as a result it isn't going to match the expected output
pattern.
Avoid this by adding a call to 'set print characters unlimited' which
allows GDB to print strings of any length.
Approved-By: Tom de Vries <tdevries@suse.de>
|
|
When I run the struct-with-sig-2.exp test with the .debug_names-using
target board, I see a gdb crash. This happens because the reader
throws an exception without calling finalize_all_units. This causes
an assertion failure later because the number of CUs and TUs doesn't
match.
The fix is to clear 'all_units' on failure.
Approved-By: Tom de Vries <tdevries@suse.de>
|
|
I noticed that running the whole testsuite in serial mode (which means
all the .exp files are ran in the same TCL environment, one after the
other) with the native-extended-gdbserver board caused some weird
failures, for instance a lot of internal errors in the reverse tests,
like:
continue^M
Continuing.^M
/home/jenkins/workspace/binutils-gdb_master_linuxbuild/platform/deb12-amd64/target_board/native-extended-gdbserver/src/binutils-gdb/gdb/remot e.c:6922: internal-error: resume: Assertion `scope_ptid == inferior_ptid' failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
----- Backtrace -----^M
FAIL: gdb.reverse/break-precsave.exp: run to end of main (GDB internal error)
This only happens after running gdb.multi/attach-while-running.exp.
That test does not restore GDBFLAGS properly when it's done, it leaves
`-ex \"maint set target-non-stop on\""` in there, which breaks some
subsequent tests. The problem is that this line:
save_vars { $::GDBFLAGS } {
should not use a `$` before the variable name. Passes the content of
`::GDBFLAGS` to save_vars, which is not what we want. We want to pass
the `::GDBFLAGS` string. Fix that.
Change-Id: I5ad32c527795fd10d0d94020e4fd15cebaca3a77
|
|
It occurred to me that there is no reason for addrmap_fixed::set_entry
to exist. This patch removes it and removes the abstract virtual
function from the base class. This then required a few minor changes
in the DWARF reader. I consider this a type-safety improvement.
Tested by rebuilding.
Reviewed-By: Tom de Vries <tdevries@suse.de>
|
|
Change-Id: I5e96c0f38aa788462ab19a9becfe22030e913c2a
|
|
When running test-case gdb.mi/mi-dprintf.exp with check-read1, I run into:
...
(gdb) ^M
PASS: gdb.mi/mi-dprintf.exp: gdb: mi 2nd dprintf stop
-data-evaluate-expression stderr^M
^done,value="0x7ffff7e4a420 <_IO_2_1_stderr_>"^M
(gdb) FAIL: gdb.mi/mi-dprintf.exp: stderr symbol check
...
The problem is in proc mi_gdb_is_stderr_available:
...
proc mi_gdb_is_stderr_available {} {
set has_stderr_symbol false
gdb_test_multiple "-data-evaluate-expression stderr" "stderr symbol check" {
-re "\\^error,msg=\"'stderr' has unknown type; cast it to its declared type\"\r\n$::mi_gdb_prompt$" {
}
-re "$::mi_gdb_prompt$" {
set has_stderr_symbol true
}
}
...
which uses a gdb_test_multiple that is supposed to use the mi prompt, but
doesn't use -prompt to indicate this. Consequently, the default patterns use
the regular gdb prompt, which trigger earlier than the two custom patterns
which use "$::mi_gdb_prompt$".
Fix this by adding the missing -prompt "$::mi_gdb_prompt$" arguments.
While we're at it, make the gdb_test_multiple call a bit more readable by
using variables, and by using -wrap.
Tested on x86_64-linux, with:
- gcc and clang (to trigger both the has_stderr_symbol true and false cases)
- make check and make check-read1.
|
|
With check-read1 we run into:
...
(gdb) break DNE>::DNE^M
Function "DNE>::DNE" not defined.^M
Make breakpoint pending on future shared library load? (y or [n]) y^M
Breakpoint 9 (DNE>::DNE) pending.^M
n^M
(gdb) FAIL: gdb.cp/namespace.exp: br malformed '>' (got interactive prompt)
n^M
...
The question is supposed to be handled by the question and response arguments
to this gdb_test call:
...
gdb_test "break DNE>::DNE" "" "br malformed \'>\'" \
"Make breakpoint pending on future shared library load?.*" "y"
...
but both this and the builtin handling in gdb_test_multiple triggers.
The cause of this is that the question argument regexp is incomplete.
Fix this by making sure that the entire question is matched in the regexp:
...
set yn_re [string_to_regexp {(y or [n])}]
...
"Make breakpoint pending on future shared library load\\? $yn_re " "Y"
...
Tested on x86_64-linux.
|
|
Per RISC-V spec, the lr/sc sequence can consist of up to 16 instructions, and we
cannot insert breakpoints in the middle of this sequence. Before this, we only
detected a specific pattern (the most common one). This patch improves this part
and now supports more complex pattern detection.
Signed-off-by: Yang Liu <liuyang22@iscas.ac.cn>
Approved-By: Andrew Burgess <aburgess@redhat.com>
Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
|
|
|
|
After this commit:
commit 1925bba80edd37c2ef90ef1d2c599dfc2fc17f72
Date: Thu Jan 4 10:01:24 2024 +0000
gdb/python: add gdb.InferiorThread.__repr__() method
failures were reported for gdb.python/py-inferior.exp.
The test grabs a gdb.InferiorThread object representing an inferior
thread, and then, later in the test, expects this Python object to
become invalid when the inferior thread has exited.
The gdb.InferiorThread object was obtained from the list returned by
calling gdb.Inferior.threads().
The mistake I made in the original commit was to assume that the order
of the threads returned from gdb.Inferior.threads() somehow reflected
the thread creation order. Specifically, I was expecting the main
thread to be first in the list, and "other" threads to appear ... not
first.
However, the gdb.Inferior.threads() function creates a list and
populates it from a map. The order of the threads in the returned
list has no obvious relationship to the thread creation order, and can
vary from host to host.
On my machine the ordering was as I expected, so the test passed for
me. For others the ordering was not as expected, and it just happened
that we ended up recording the gdb.InferiorThread for the main thread.
As the main thread doesn't exit (until the test is over), the
gdb.InferiorThread object never became invalid, and the test failed.
Fixed in this commit by taking more care to correctly find a non-main
thread. I do this by recording the main thread early on (when there
is only one inferior thread), and then finding any thread that is not
this main thread.
Then, once all of the secondary threads have exited, I know that the
second InferiorThread object I found should now be invalid.
The test still passes for me, and I believe this should fix the issue
for everyone else too.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31238
|
|
This commit is the result of the following actions:
- Running gdb/copyright.py to update all of the copyright headers to
include 2024,
- Manually updating a few files the copyright.py script told me to
update, these files had copyright headers embedded within the
file,
- Regenerating gdbsupport/Makefile.in to refresh it's copyright
date,
- Using grep to find other files that still mentioned 2023. If
these files were updated last year from 2022 to 2023 then I've
updated them this year to 2024.
I'm sure I've probably missed some dates. Feel free to fix them up as
you spot them.
|
|
This commit updates the Python example code in the gdb.Progspace and
gdb.Objfile sections of the docs. Changes made:
1. Use @value{GDBP} for the GDB prompt rather than
hard-coding (gdB),
2. Use @group...@end group to split the example code into
unbreakable chunks, and
3. Add parenthesis to the Python print() calls in the examples. In
Python 2 it was OK to drop the parenthesis, but now GDB is Python 3
only, example code should include the parenthesis.
Approved-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
|
|
In previous commits I've added Object.__dict__ support to gdb.Inferior
and gdb.InferiorThread, this is similar to the existing support for
gdb.Objfile and gdb.Progspace.
This commit extends the documentation to offer the user some guidance
on selecting good names for their custom attributes so they
can (hopefully) avoid conflicting with any future attributes that GDB
might add.
The rules I've proposed are:
1. Don't start user attributes with a lower case letter, all the
current GDB attributes start with a lower case letter, and I suspect
all future attributes would also start with a lower case letter, and
2. Don't start user attributes with a double underscore, this risks
conflicting with Python built in attributes (e.g. __dict__) - though
clearly the user would need to start and end with a double
underscore, but it seemed easier just to say no double underscores.
I'm doing this as a separate commit as I've updated the docs for the
existing gdb.Objfile and gdb.Progspace so they all reference a single
paragraph on selecting attribute names.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
|