public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb: Check for nullptr when computing srcpath
@ 2020-02-28 0:10 Aaron Merey
0 siblings, 0 replies; only message in thread
From: Aaron Merey @ 2020-02-28 0:10 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e5da11393a16416afc0c0a1da9914b6424f37fa8
commit e5da11393a16416afc0c0a1da9914b6424f37fa8
Author: Aaron Merey <amerey@redhat.com>
Date: Thu Feb 27 19:07:01 2020 -0500
gdb: Check for nullptr when computing srcpath
This fixes a regression caused by commit 0d79cdc494d5:
$ make check TESTS="gdb.dwarf2/dw2-ranges-base.exp"
[...]
ERROR: GDB process no longer exists
This error is caused by an abort during the computation of srcpath
when SYMTAB_DIRNAME (s) == NULL.
Computing srcpath only when SYMTAB_DIRNAME (s) is not NULL fixes this
error. Also change the condition for calling debuginfod_source_query
to include whether srcpath could be computed.
gdb/ChangeLog:
2020-02-27 Aaron Merey <amerey@redhat.com>
* source.c (open_source_file): Check for nullptr when computing
srcpath.
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/source.c | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d99c178..ff2172c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-02-27 Aaron Merey <amerey@redhat.com>
+
+ * source.c (open_source_file): Check for nullptr when computing
+ srcpath.
+
2020-02-27 Tom Tromey <tromey@adacore.com>
* dwarf2/read.c (struct field_info) <nfields>: Now a method, not a
diff --git a/gdb/source.c b/gdb/source.c
index 051caf5..50de939 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1160,7 +1160,7 @@ open_source_file (struct symtab *s)
std::string srcpath;
if (IS_ABSOLUTE_PATH (s->filename))
srcpath = s->filename;
- else
+ else if (SYMTAB_DIRNAME (s) != nullptr)
{
srcpath = SYMTAB_DIRNAME (s);
srcpath += SLASH_STRING;
@@ -1170,7 +1170,7 @@ open_source_file (struct symtab *s)
const struct bfd_build_id *build_id = build_id_bfd_get (ofp->obfd);
/* Query debuginfod for the source file. */
- if (build_id != nullptr)
+ if (build_id != nullptr && !srcpath.empty ())
fd = debuginfod_source_query (build_id->data,
build_id->size,
srcpath.c_str (),
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-02-28 0:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-28 0:10 [binutils-gdb] gdb: Check for nullptr when computing srcpath Aaron Merey
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).