public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] When getting the locno of a bpstat, handle the case of bp with null locations.
@ 2022-11-21 21:02 Philippe Waroquiers
0 siblings, 0 replies; only message in thread
From: Philippe Waroquiers @ 2022-11-21 21:02 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=28a072f4af84ad295d37f8aa70c5fec9d36a274c
commit 28a072f4af84ad295d37f8aa70c5fec9d36a274c
Author: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Date: Sun Nov 20 17:42:12 2022 +0100
When getting the locno of a bpstat, handle the case of bp with null locations.
The test py-objfile.exp unloads the current file while debugging the process.
This results in bpstat bs->b->loc to become nullptr.
Handle this case in breakpoint.c:bpstat_locno.
Note: GDB crashes on this problem with an internal error,
but the end of gdb summary shows:
...
=== gdb Summary ===
# of expected passes 36
The output also does not contain a 'FAIL:'.
After the fix, the nr of expected passes increased.
In the gdb.log output, one can see:
...
Fatal signal: Segmentation fault
----- Backtrace -----
0x55698905c5b9 gdb_internal_backtrace_1
../../binutils-gdb/gdb/bt-utils.c:122
0x55698905c5b9 _Z22gdb_internal_backtracev
...
ERROR: Couldn't send python print(objfile.filename) to GDB.
ERROR: : spawn id exp9 not open
while executing
"expect {
-i exp9 -timeout 10
-re ".*A problem internal to GDB has been detected" {
fail "$message (GDB internal error)"
gdb_internal_error..."
("uplevel" body line 1)
invoked from within
....
Wondering if it might be possible to improve gdb_test to have
gdb_test "python print(objfile.filename)" "None" \
"objfile.filename after objfile is unloaded"
reporting a failed result instead of just producing the internal error.
Diff:
---
gdb/breakpoint.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 5b691673a0e..a161b78a8aa 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -4486,7 +4486,7 @@ bpstat_locno (const bpstat *bs)
int locno = 0;
- if (b != nullptr && b->loc->next != nullptr)
+ if (b != nullptr && b->loc != nullptr && b->loc->next != nullptr)
{
const bp_location *bl_i;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-21 21:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-21 21:02 [binutils-gdb] When getting the locno of a bpstat, handle the case of bp with null locations Philippe Waroquiers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).