--- gdb-5.2.1/gdb/symfile.c.orig Mon Sep 29 12:33:04 2003 +++ gdb-5.2.1/gdb/symfile.c Mon Sep 29 13:17:56 2003 @@ -675,7 +675,7 @@ syms_from_objfile (struct objfile *objfi /* Calculate offsets for sections. */ for (i=0 ; i < MAX_SECTIONS && addrs->other[i].name; i++) { - if (addrs->other[i].addr != 0) + if (addrs->other[i].addr != 0 || addrs->other[i].valid) { sect = bfd_get_section_by_name (objfile->obfd, addrs->other[i].name); if (sect) @@ -1483,6 +1483,7 @@ add_symbol_file_command (char *args, int { char *name; char *value; + int valid; } sect_opts[SECT_OFF_MAX]; struct section_addr_info section_addrs; @@ -1498,6 +1499,7 @@ add_symbol_file_command (char *args, int /* Ensure section_addrs is initialized */ memset (§ion_addrs, 0, sizeof (section_addrs)); + memset (§_opts, 0, sizeof (sect_opts)); while (*args != '\000') { @@ -1531,6 +1533,7 @@ add_symbol_file_command (char *args, int to load the program. */ sect_opts[section_index].name = ".text"; sect_opts[section_index].value = arg; + sect_opts[section_index].valid = 1; section_index++; } else @@ -1565,6 +1568,7 @@ add_symbol_file_command (char *args, int if (expecting_sec_addr) { sect_opts[section_index].value = arg; + sect_opts[section_index].valid = 1; expecting_sec_addr = 0; section_index++; } @@ -1587,7 +1591,8 @@ add_symbol_file_command (char *args, int CORE_ADDR addr; char *val = sect_opts[i].value; char *sec = sect_opts[i].name; - + int valid = sect_opts[i].valid; + val = sect_opts[i].value; if (val[0] == '0' && val[1] == 'x') addr = strtoul (val+2, NULL, 16); @@ -1598,6 +1603,7 @@ add_symbol_file_command (char *args, int entered on the command line. */ section_addrs.other[sec_num].name = sec; section_addrs.other[sec_num].addr = addr; + section_addrs.other[sec_num].valid = valid; printf_filtered ("\t%s_addr = %s\n", sec, local_hex_string ((unsigned long)addr)); --- gdb-5.2.1/gdb/symfile.h.orig Mon Sep 29 13:35:09 2003 +++ gdb-5.2.1/gdb/symfile.h Mon Sep 29 13:35:17 2003 @@ -71,6 +71,7 @@ struct section_addr_info CORE_ADDR addr; char *name; int sectindex; + int valid; } other[MAX_SECTIONS]; };