Fix uninitialized warning in gdb_bfd_open
The previous patch introduced an uninitialized warning in gdb_bfd_open. The problem was that "abfd" was being used without being initialized. This patch fixes the problem by calling bfd_fopen in the branch where "fstat" has failed. gdb/ChangeLog 2020-09-08 Tom Tromey <tromey@adacore.com> * gdb_bfd.c (gdb_bfd_open): Call bfd_fopen when fstat fails.
This commit is contained in:
parent
3cae444768
commit
03b0a45f15
2 changed files with 9 additions and 3 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2020-09-08 Tom Tromey <tromey@adacore.com>
|
||||||
|
|
||||||
|
* gdb_bfd.c (gdb_bfd_open): Call bfd_fopen when fstat fails.
|
||||||
|
|
||||||
2020-09-08 Tom Tromey <tromey@adacore.com>
|
2020-09-08 Tom Tromey <tromey@adacore.com>
|
||||||
|
|
||||||
PR win32/25302:
|
PR win32/25302:
|
||||||
|
|
|
@ -445,9 +445,11 @@ gdb_bfd_open (const char *name, const char *target, int fd,
|
||||||
/* Weird situation here -- don't cache if we can't stat. */
|
/* Weird situation here -- don't cache if we can't stat. */
|
||||||
if (debug_bfd_cache)
|
if (debug_bfd_cache)
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"Could not stat bfd %s for %s - not caching\n",
|
"Could not stat %s - not caching\n",
|
||||||
host_address_to_string (abfd),
|
name);
|
||||||
bfd_get_filename (abfd));
|
abfd = bfd_fopen (name, target, FOPEN_RB, fd);
|
||||||
|
if (abfd == nullptr)
|
||||||
|
return nullptr;
|
||||||
return gdb_bfd_ref_ptr::new_reference (abfd);
|
return gdb_bfd_ref_ptr::new_reference (abfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue