aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib-svr4.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2011-06-30 18:48:19 +0000
committerTom Tromey <tromey@redhat.com>2011-06-30 18:48:19 +0000
commit3bb47e8bce4c147142b298c5c23368ba189105bc (patch)
tree3c690a64aeedd9d72f9cedc4a687491d80ba2f40 /gdb/solib-svr4.c
parent4727bad393ed5ccd73480968cbf3c4f5003542bc (diff)
downloadgdb-3bb47e8bce4c147142b298c5c23368ba189105bc.zip
gdb-3bb47e8bce4c147142b298c5c23368ba189105bc.tar.gz
gdb-3bb47e8bce4c147142b298c5c23368ba189105bc.tar.bz2
* symfile-mem.c (symbol_file_add_from_memory): Call do_cleanups.
* solib-svr4.c (open_symbol_file_object): Call do_cleanups on all return paths. Defer final do_cleanups until last return. * arm-tdep.c (arm_exidx_new_objfile): Make null cleanup after early return.
Diffstat (limited to 'gdb/solib-svr4.c')
-rw-r--r--gdb/solib-svr4.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index f668f83..d92a83c 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1021,17 +1021,26 @@ open_symbol_file_object (void *from_ttyp)
if (symfile_objfile)
if (!query (_("Attempt to reload symbols from process? ")))
- return 0;
+ {
+ do_cleanups (cleanups);
+ return 0;
+ }
/* Always locate the debug struct, in case it has moved. */
info->debug_base = 0;
if (locate_base (info) == 0)
- return 0; /* failed somehow... */
+ {
+ do_cleanups (cleanups);
+ return 0; /* failed somehow... */
+ }
/* First link map member should be the executable. */
lm = solib_svr4_r_map (info);
if (lm == 0)
- return 0; /* failed somehow... */
+ {
+ do_cleanups (cleanups);
+ return 0; /* failed somehow... */
+ }
/* Read address of name from target memory to GDB. */
read_memory (lm + lmo->l_name_offset, l_name_buf, l_name_size);
@@ -1039,11 +1048,11 @@ open_symbol_file_object (void *from_ttyp)
/* Convert the address to host format. */
l_name = extract_typed_address (l_name_buf, ptr_type);
- /* Free l_name_buf. */
- do_cleanups (cleanups);
-
if (l_name == 0)
- return 0; /* No filename. */
+ {
+ do_cleanups (cleanups);
+ return 0; /* No filename. */
+ }
/* Now fetch the filename from target memory. */
target_read_string (l_name, &filename, SO_NAME_MAX_PATH_SIZE - 1, &errcode);
@@ -1053,12 +1062,14 @@ open_symbol_file_object (void *from_ttyp)
{
warning (_("failed to read exec filename from attached file: %s"),
safe_strerror (errcode));
+ do_cleanups (cleanups);
return 0;
}
/* Have a pathname: read the symbol file. */
symbol_file_add_main (filename, from_tty);
+ do_cleanups (cleanups);
return 1;
}