From b3fdaf3d368003efaef252f67e0c7ca2a624277f Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Mon, 22 Apr 1991 20:09:26 +0000 Subject: [PATCH] * symfile.c (symbol_file_add): Add comment. solib.c (solib_add): Don't malloc name passed to symbol_file_add. --- gdb/ChangeLog | 20 ++++++++++++++++++++ gdb/solib.c | 26 ++++++++++++++------------ gdb/symfile.c | 9 +++++---- 3 files changed, 39 insertions(+), 16 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4054dc36d28..0abdebb8367 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,25 @@ Mon Apr 22 00:02:43 1991 Jim Kingdon (kingdon at cygint.cygnus.com) + * symfile.c (symbol_file_add): Add comment. + solib.c (solib_add): Don't malloc name passed to symbol_file_add. + + * exec.c (build_section_table): If *start isn't NULL, free it. + + * stack.c (parse_frame_specification): Error if NULL selected_frame. + + * infcmd.c (finish_command): Error if NULL selected_frame. + + * inflow.c (kill_command): Deal with NULL selected_frame. + + * stack.c (record_selected_frame): Set *FRAMEP to NULL if there + is no selected frame. + infrun.c (restore_inferior_status): Add comment. + + * findvar.c (read_var_value): Check for NULL frame where we need + a frame. + + * breakpoint.c (get_catch_sals): Check for NULL selected_frame. + * breakpoint.c (bpstat_print): Try all elements on the bpstat chain before giving up with an internal error. diff --git a/gdb/solib.c b/gdb/solib.c index ab9336f003b..1730b65e1c9 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -27,6 +27,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "symtab.h" #include "gdbcore.h" #include "command.h" +#include "target.h" /* ** local data declarations @@ -94,13 +95,18 @@ int i; ** Advance to next local abbreviated load_map structure */ if (!(inferior_lm = so_list_ptr->inferior_lm.lm_next)) { - /* - ** See if any were added - */ - read_memory((CORE_ADDR)so_list_ptr->inferior_lm_add, - &so_list_ptr->inferior_lm, - sizeof(struct link_map)); - inferior_lm = so_list_ptr->inferior_lm.lm_next; + /* See if any were added, but be quiet if we can't read + from the target any more. */ + int status; + + status = target_read_memory ( + (CORE_ADDR)so_list_ptr->inferior_lm_add, + &so_list_ptr->inferior_lm, + sizeof(struct link_map)); + if (status == 0) + inferior_lm = so_list_ptr->inferior_lm.lm_next; + else + inferior_lm = 0; } so_list_next = so_list_ptr->next; } @@ -168,11 +174,7 @@ int from_tty; if (so->symbols_loaded) { printf("Symbols already loaded for %s\n", so->inferior_so_name); } else { - /* File Name String Freed by processing */ - sz = strlen(so->inferior_so_name) + 1; - val = (char *) xmalloc(sz); - bcopy(so->inferior_so_name, val, sz); - symbol_file_add (val, from_tty, + symbol_file_add (so->inferior_so_name, from_tty, (unsigned int)so->inferior_lm.lm_addr, 0); so->symbols_loaded = 1; } diff --git a/gdb/symfile.c b/gdb/symfile.c index ab75f2289cb..395d7306ddf 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -379,10 +379,11 @@ psymtab_to_symtab (pst) /* Process a symbol file, as either the main file or as a dynamically loaded file. - NAME is the file name (which will be tilde-expanded and made absolute - herein). FROM_TTY says how verbose to be. MAINLINE specifies whether - this is the main symbol file, or whether it's an extra symbol file - such as dynamically loaded code. If !mainline, ADDR is the address + NAME is the file name (which will be tilde-expanded and made + absolute herein) (but we don't free or modify NAME itself). + FROM_TTY says how verbose to be. MAINLINE specifies whether this + is the main symbol file, or whether it's an extra symbol file such + as dynamically loaded code. If !mainline, ADDR is the address where the text segment was loaded. */ void -- 2.30.2