mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-03 21:34:46 +08:00
Thu Apr 23 12:27:43 1998 Philippe De Muyter <phdm@macqel.be>
* symfile.c (simple_overlay_update_1): Do not prefix array address by `&'. * bcache.h (BCACHE_DATA_ALIGNMENT): Ditto. * tracepoint.c (encode_actions): Ditto. * language.c, complaints.c, utils.c (varargs.h): Do not include that file here, it is already included indirectly by defs.h. * dbxread.c (dbx_symfile_init, process_one_symbol): Cast xmalloc return value to the appropriate pointer type. * utils.c (floatformat_from_doublest): Ditto. * tracepoint.c (read_actions, _initialize_tracepoint): Ditto. (add_memrange): Likewise with xrealloc return value. * stabsread.c (ref_add): Ditto. * coffread.c (coff_symfile_init): Likewise for xmmalloc return value. * elfread.c (elf_symfile_read): Ditto. * os9kread.c (os9k_symfile_init): Ditto.
This commit is contained in:
@ -1,3 +1,21 @@
|
|||||||
|
Thu Apr 23 12:27:43 1998 Philippe De Muyter <phdm@macqel.be>
|
||||||
|
|
||||||
|
* symfile.c (simple_overlay_update_1): Do not prefix array address
|
||||||
|
by `&'.
|
||||||
|
* bcache.h (BCACHE_DATA_ALIGNMENT): Ditto.
|
||||||
|
* tracepoint.c (encode_actions): Ditto.
|
||||||
|
* language.c, complaints.c, utils.c (varargs.h): Do not include that
|
||||||
|
file here, it is already included indirectly by defs.h.
|
||||||
|
* dbxread.c (dbx_symfile_init, process_one_symbol): Cast xmalloc return
|
||||||
|
value to the appropriate pointer type.
|
||||||
|
* utils.c (floatformat_from_doublest): Ditto.
|
||||||
|
* tracepoint.c (read_actions, _initialize_tracepoint): Ditto.
|
||||||
|
(add_memrange): Likewise with xrealloc return value.
|
||||||
|
* stabsread.c (ref_add): Ditto.
|
||||||
|
* coffread.c (coff_symfile_init): Likewise for xmmalloc return value.
|
||||||
|
* elfread.c (elf_symfile_read): Ditto.
|
||||||
|
* os9kread.c (os9k_symfile_init): Ditto.
|
||||||
|
|
||||||
Thu Apr 23 00:32:08 1998 Tom Tromey <tromey@cygnus.com>
|
Thu Apr 23 00:32:08 1998 Tom Tromey <tromey@cygnus.com>
|
||||||
|
|
||||||
* config.in: Rebuilt.
|
* config.in: Rebuilt.
|
||||||
|
@ -47,7 +47,7 @@ struct hashlink {
|
|||||||
a hashlink struct to hold the next pointer and the data. */
|
a hashlink struct to hold the next pointer and the data. */
|
||||||
|
|
||||||
#define BCACHE_DATA_ALIGNMENT \
|
#define BCACHE_DATA_ALIGNMENT \
|
||||||
(((char *) &BCACHE_DATA((struct hashlink*) 0) - (char *) 0))
|
(((char *) BCACHE_DATA((struct hashlink*) 0) - (char *) 0))
|
||||||
|
|
||||||
struct bcache {
|
struct bcache {
|
||||||
struct obstack cache;
|
struct obstack cache;
|
||||||
|
@ -20,11 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "complaints.h"
|
#include "complaints.h"
|
||||||
#include "gdbcmd.h"
|
#include "gdbcmd.h"
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stdarg.h>
|
|
||||||
#else
|
|
||||||
#include <varargs.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Structure to manage complaints about symbol file contents. */
|
/* Structure to manage complaints about symbol file contents. */
|
||||||
|
|
||||||
|
@ -596,7 +596,7 @@ elf_symfile_read (objfile, section_offsets, mainline)
|
|||||||
memset ((char *) &ei, 0, sizeof (ei));
|
memset ((char *) &ei, 0, sizeof (ei));
|
||||||
|
|
||||||
/* Allocate struct to keep track of the symfile */
|
/* Allocate struct to keep track of the symfile */
|
||||||
objfile->sym_stab_info = (PTR)
|
objfile->sym_stab_info = (struct dbx_symfile_info *)
|
||||||
xmmalloc (objfile -> md, sizeof (struct dbx_symfile_info));
|
xmmalloc (objfile -> md, sizeof (struct dbx_symfile_info));
|
||||||
memset ((char *) objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info));
|
memset ((char *) objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info));
|
||||||
make_cleanup (free_elfinfo, (PTR) objfile);
|
make_cleanup (free_elfinfo, (PTR) objfile);
|
||||||
|
@ -30,11 +30,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "gdb_string.h"
|
#include "gdb_string.h"
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stdarg.h>
|
|
||||||
#else
|
|
||||||
#include <varargs.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "symtab.h"
|
#include "symtab.h"
|
||||||
#include "gdbtypes.h"
|
#include "gdbtypes.h"
|
||||||
|
@ -400,7 +400,7 @@ os9k_symfile_init (objfile)
|
|||||||
objfile->auxf1 = minfile;
|
objfile->auxf1 = minfile;
|
||||||
|
|
||||||
/* Allocate struct to keep track of the symfile */
|
/* Allocate struct to keep track of the symfile */
|
||||||
objfile->sym_stab_info = (PTR)
|
objfile->sym_stab_info = (struct dbx_symfile_info *)
|
||||||
xmmalloc (objfile -> md, sizeof (struct dbx_symfile_info));
|
xmmalloc (objfile -> md, sizeof (struct dbx_symfile_info));
|
||||||
DBX_SYMFILE_INFO (objfile)->stab_section_info = NULL;
|
DBX_SYMFILE_INFO (objfile)->stab_section_info = NULL;
|
||||||
|
|
||||||
|
@ -1194,7 +1194,8 @@ ref_add (refnum, sym, stabs, value)
|
|||||||
{
|
{
|
||||||
int new_slots = ref_count - ref_chunk * MAX_CHUNK_REFS;
|
int new_slots = ref_count - ref_chunk * MAX_CHUNK_REFS;
|
||||||
int new_chunks = new_slots / MAX_CHUNK_REFS + 1;
|
int new_chunks = new_slots / MAX_CHUNK_REFS + 1;
|
||||||
ref_map = xrealloc (ref_map, REF_MAP_SIZE(ref_chunk + new_chunks));
|
ref_map = (struct ref_map_s *)
|
||||||
|
xrealloc (ref_map, REF_MAP_SIZE(ref_chunk + new_chunks));
|
||||||
if (!ref_map)
|
if (!ref_map)
|
||||||
error ("no more free slots in chain\n");
|
error ("no more free slots in chain\n");
|
||||||
memset (ref_map + REF_MAP_SIZE(ref_chunk), 0, new_chunks * REF_CHUNK_SIZE);
|
memset (ref_map + REF_MAP_SIZE(ref_chunk), 0, new_chunks * REF_CHUNK_SIZE);
|
||||||
|
@ -53,6 +53,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int (*ui_load_progress_hook) PARAMS ((char *, unsigned long));
|
int (*ui_load_progress_hook) PARAMS ((char *, unsigned long));
|
||||||
|
void (*pre_add_symbol_hook) PARAMS ((char *));
|
||||||
|
void (*post_add_symbol_hook) PARAMS ((void));
|
||||||
|
|
||||||
/* Global variables owned by this file */
|
/* Global variables owned by this file */
|
||||||
int readnow_symbol_files; /* Read full symbols immediately */
|
int readnow_symbol_files; /* Read full symbols immediately */
|
||||||
@ -655,11 +657,16 @@ symbol_file_add (name, from_tty, addr, mainline, mapped, readnow)
|
|||||||
symbol table file which has not had initial symbol reading
|
symbol table file which has not had initial symbol reading
|
||||||
performed, or need to read an unmapped symbol table. */
|
performed, or need to read an unmapped symbol table. */
|
||||||
if (from_tty || info_verbose)
|
if (from_tty || info_verbose)
|
||||||
|
{
|
||||||
|
if (pre_add_symbol_hook)
|
||||||
|
pre_add_symbol_hook (name);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
printf_filtered ("Reading symbols from %s...", name);
|
printf_filtered ("Reading symbols from %s...", name);
|
||||||
wrap_here ("");
|
wrap_here ("");
|
||||||
gdb_flush (gdb_stdout);
|
gdb_flush (gdb_stdout);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
syms_from_objfile (objfile, addr, mainline, from_tty);
|
syms_from_objfile (objfile, addr, mainline, from_tty);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -686,10 +693,15 @@ symbol_file_add (name, from_tty, addr, mainline, mapped, readnow)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (from_tty || info_verbose)
|
if (from_tty || info_verbose)
|
||||||
|
{
|
||||||
|
if (post_add_symbol_hook)
|
||||||
|
post_add_symbol_hook ();
|
||||||
|
else
|
||||||
{
|
{
|
||||||
printf_filtered ("done.\n");
|
printf_filtered ("done.\n");
|
||||||
gdb_flush (gdb_stdout);
|
gdb_flush (gdb_stdout);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
new_symfile_objfile (objfile, mainline, from_tty);
|
new_symfile_objfile (objfile, mainline, from_tty);
|
||||||
|
|
||||||
@ -957,6 +969,8 @@ load_command (arg, from_tty)
|
|||||||
to worry about finding it, and (b) On VMS, fork() is very slow and so
|
to worry about finding it, and (b) On VMS, fork() is very slow and so
|
||||||
we don't want to run a subprocess. On the other hand, I'm not sure how
|
we don't want to run a subprocess. On the other hand, I'm not sure how
|
||||||
performance compares. */
|
performance compares. */
|
||||||
|
#define GENERIC_LOAD_CHUNK 256
|
||||||
|
#define VALIDATE_DOWNLOAD 0
|
||||||
void
|
void
|
||||||
generic_load (filename, from_tty)
|
generic_load (filename, from_tty)
|
||||||
char *filename;
|
char *filename;
|
||||||
@ -969,7 +983,10 @@ generic_load (filename, from_tty)
|
|||||||
unsigned long data_count = 0; /* Number of bytes transferred to memory */
|
unsigned long data_count = 0; /* Number of bytes transferred to memory */
|
||||||
int n;
|
int n;
|
||||||
unsigned long load_offset = 0; /* offset to add to vma for each section */
|
unsigned long load_offset = 0; /* offset to add to vma for each section */
|
||||||
char buf[128];
|
char buf[GENERIC_LOAD_CHUNK+8];
|
||||||
|
#if VALIDATE_DOWNLOAD
|
||||||
|
char verify_buffer[GENERIC_LOAD_CHUNK+8] ;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* enable user to specify address for downloading as 2nd arg to load */
|
/* enable user to specify address for downloading as 2nd arg to load */
|
||||||
n = sscanf(filename, "%s 0x%lx", buf, &load_offset);
|
n = sscanf(filename, "%s 0x%lx", buf, &load_offset);
|
||||||
@ -1009,14 +1026,13 @@ generic_load (filename, from_tty)
|
|||||||
char *buffer;
|
char *buffer;
|
||||||
struct cleanup *old_chain;
|
struct cleanup *old_chain;
|
||||||
bfd_vma lma;
|
bfd_vma lma;
|
||||||
unsigned long l = size / 100;
|
unsigned long l = size ;
|
||||||
int err;
|
int err;
|
||||||
char *sect;
|
char *sect;
|
||||||
unsigned long sent;
|
unsigned long sent;
|
||||||
unsigned long len;
|
unsigned long len;
|
||||||
|
|
||||||
l = l > 100 ? l : 100;
|
l = l > GENERIC_LOAD_CHUNK ? GENERIC_LOAD_CHUNK : l ;
|
||||||
data_count += size;
|
|
||||||
|
|
||||||
buffer = xmalloc (size);
|
buffer = xmalloc (size);
|
||||||
old_chain = make_cleanup (free, buffer);
|
old_chain = make_cleanup (free, buffer);
|
||||||
@ -1034,7 +1050,7 @@ generic_load (filename, from_tty)
|
|||||||
|
|
||||||
bfd_get_section_contents (loadfile_bfd, s, buffer, 0, size);
|
bfd_get_section_contents (loadfile_bfd, s, buffer, 0, size);
|
||||||
|
|
||||||
sect = bfd_get_section_name (loadfile_bfd, s);
|
sect = (char *) bfd_get_section_name (loadfile_bfd, s);
|
||||||
sent = 0;
|
sent = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -1044,9 +1060,24 @@ generic_load (filename, from_tty)
|
|||||||
if (ui_load_progress_hook)
|
if (ui_load_progress_hook)
|
||||||
if (ui_load_progress_hook (sect, sent))
|
if (ui_load_progress_hook (sect, sent))
|
||||||
error ("Canceled the download");
|
error ("Canceled the download");
|
||||||
|
#if VALIDATE_DOWNLOAD
|
||||||
|
/* Broken memories and broken monitors manifest themselves
|
||||||
|
here when bring new computers to life.
|
||||||
|
This doubles already slow downloads.
|
||||||
|
*/
|
||||||
|
if (err) break ;
|
||||||
|
{
|
||||||
|
target_read_memory(lma,verify_buffer,len) ;
|
||||||
|
if (0 != bcmp(buffer,verify_buffer,len))
|
||||||
|
error("Download verify failed at %08x",
|
||||||
|
(unsigned long)lma) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
data_count += len ;
|
||||||
lma += len;
|
lma += len;
|
||||||
buffer += len;
|
buffer += len;
|
||||||
}
|
} /* od */
|
||||||
while (err == 0 && sent < size);
|
while (err == 0 && sent < size);
|
||||||
|
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
@ -1059,12 +1090,14 @@ generic_load (filename, from_tty)
|
|||||||
}
|
}
|
||||||
|
|
||||||
end_time = time (NULL);
|
end_time = time (NULL);
|
||||||
|
{
|
||||||
printf_filtered ("Start address 0x%lx\n", loadfile_bfd->start_address);
|
unsigned long entry ;
|
||||||
|
entry = bfd_get_start_address(loadfile_bfd) ;
|
||||||
|
printf_filtered ("Start address 0x%lx , load size %d\n", entry,data_count);
|
||||||
/* We were doing this in remote-mips.c, I suspect it is right
|
/* We were doing this in remote-mips.c, I suspect it is right
|
||||||
for other targets too. */
|
for other targets too. */
|
||||||
write_pc (loadfile_bfd->start_address);
|
write_pc (entry);
|
||||||
|
}
|
||||||
|
|
||||||
/* FIXME: are we supposed to call symbol_file_add or not? According to
|
/* FIXME: are we supposed to call symbol_file_add or not? According to
|
||||||
a comment from remote-mips.c (where a call to symbol_file_add was
|
a comment from remote-mips.c (where a call to symbol_file_add was
|
||||||
@ -2401,7 +2434,7 @@ static CORE_ADDR cache_ovly_table_base = 0;
|
|||||||
static CORE_ADDR cache_ovly_region_table_base = 0;
|
static CORE_ADDR cache_ovly_region_table_base = 0;
|
||||||
#endif
|
#endif
|
||||||
enum ovly_index { VMA, SIZE, LMA, MAPPED};
|
enum ovly_index { VMA, SIZE, LMA, MAPPED};
|
||||||
#define TARGET_INT_BYTES (TARGET_INT_BIT / TARGET_CHAR_BIT)
|
#define TARGET_LONG_BYTES (TARGET_LONG_BIT / TARGET_CHAR_BIT)
|
||||||
|
|
||||||
/* Throw away the cached copy of _ovly_table */
|
/* Throw away the cached copy of _ovly_table */
|
||||||
static void
|
static void
|
||||||
@ -2430,18 +2463,18 @@ simple_free_overlay_region_table ()
|
|||||||
/* Read an array of ints from the target into a local buffer.
|
/* Read an array of ints from the target into a local buffer.
|
||||||
Convert to host order. int LEN is number of ints */
|
Convert to host order. int LEN is number of ints */
|
||||||
static void
|
static void
|
||||||
read_target_int_array (memaddr, myaddr, len)
|
read_target_long_array (memaddr, myaddr, len)
|
||||||
CORE_ADDR memaddr;
|
CORE_ADDR memaddr;
|
||||||
unsigned int *myaddr;
|
unsigned int *myaddr;
|
||||||
int len;
|
int len;
|
||||||
{
|
{
|
||||||
char *buf = alloca (len * TARGET_INT_BYTES);
|
char *buf = alloca (len * TARGET_LONG_BYTES);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
read_memory (memaddr, buf, len * TARGET_INT_BYTES);
|
read_memory (memaddr, buf, len * TARGET_LONG_BYTES);
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
myaddr[i] = extract_unsigned_integer (TARGET_INT_BYTES * i + buf,
|
myaddr[i] = extract_unsigned_integer (TARGET_LONG_BYTES * i + buf,
|
||||||
TARGET_INT_BYTES);
|
TARGET_LONG_BYTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find and grab a copy of the target _ovly_table
|
/* Find and grab a copy of the target _ovly_table
|
||||||
@ -2464,7 +2497,7 @@ simple_read_overlay_table ()
|
|||||||
if (msym != NULL)
|
if (msym != NULL)
|
||||||
{
|
{
|
||||||
cache_ovly_table_base = SYMBOL_VALUE_ADDRESS (msym);
|
cache_ovly_table_base = SYMBOL_VALUE_ADDRESS (msym);
|
||||||
read_target_int_array (cache_ovly_table_base,
|
read_target_long_array (cache_ovly_table_base,
|
||||||
(int *) cache_ovly_table,
|
(int *) cache_ovly_table,
|
||||||
cache_novlys * 4);
|
cache_novlys * 4);
|
||||||
}
|
}
|
||||||
@ -2497,7 +2530,7 @@ simple_read_overlay_region_table ()
|
|||||||
if (msym != NULL)
|
if (msym != NULL)
|
||||||
{
|
{
|
||||||
cache_ovly_region_table_base = SYMBOL_VALUE_ADDRESS (msym);
|
cache_ovly_region_table_base = SYMBOL_VALUE_ADDRESS (msym);
|
||||||
read_target_int_array (cache_ovly_region_table_base,
|
read_target_long_array (cache_ovly_region_table_base,
|
||||||
(int *) cache_ovly_region_table,
|
(int *) cache_ovly_region_table,
|
||||||
cache_novly_regions * 3);
|
cache_novly_regions * 3);
|
||||||
}
|
}
|
||||||
@ -2530,8 +2563,8 @@ simple_overlay_update_1 (osect)
|
|||||||
cache_ovly_table[i][LMA] == osect->the_bfd_section->lma /* &&
|
cache_ovly_table[i][LMA] == osect->the_bfd_section->lma /* &&
|
||||||
cache_ovly_table[i][SIZE] == size */)
|
cache_ovly_table[i][SIZE] == size */)
|
||||||
{
|
{
|
||||||
read_target_int_array (cache_ovly_table_base + i * TARGET_INT_BYTES,
|
read_target_long_array (cache_ovly_table_base + i * TARGET_LONG_BYTES,
|
||||||
(int *) &cache_ovly_table[i], 4);
|
(int *) cache_ovly_table[i], 4);
|
||||||
if (cache_ovly_table[i][VMA] == osect->the_bfd_section->vma &&
|
if (cache_ovly_table[i][VMA] == osect->the_bfd_section->vma &&
|
||||||
cache_ovly_table[i][LMA] == osect->the_bfd_section->lma /* &&
|
cache_ovly_table[i][LMA] == osect->the_bfd_section->lma /* &&
|
||||||
cache_ovly_table[i][SIZE] == size */)
|
cache_ovly_table[i][SIZE] == size */)
|
||||||
|
@ -842,7 +842,7 @@ read_actions (t)
|
|||||||
if (linetype == BADLINE)
|
if (linetype == BADLINE)
|
||||||
continue; /* already warned -- collect another line */
|
continue; /* already warned -- collect another line */
|
||||||
|
|
||||||
temp = xmalloc (sizeof (struct action_line));
|
temp = (struct action_line *) xmalloc (sizeof (struct action_line));
|
||||||
temp->next = NULL;
|
temp->next = NULL;
|
||||||
temp->action = line;
|
temp->action = line;
|
||||||
|
|
||||||
@ -1169,7 +1169,7 @@ add_memrange (memranges, type, base, len)
|
|||||||
if (memranges->next_memrange >= memranges->listsize)
|
if (memranges->next_memrange >= memranges->listsize)
|
||||||
{
|
{
|
||||||
memranges->listsize *= 2;
|
memranges->listsize *= 2;
|
||||||
memranges->list = xrealloc (memranges->list,
|
memranges->list = (struct memrange *) xrealloc (memranges->list,
|
||||||
memranges->listsize);
|
memranges->listsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1502,8 +1502,8 @@ encode_actions (t, tdp_actions, step_count, stepping_actions)
|
|||||||
memrange_sortmerge (&tracepoint_list);
|
memrange_sortmerge (&tracepoint_list);
|
||||||
memrange_sortmerge (&stepping_list);
|
memrange_sortmerge (&stepping_list);
|
||||||
|
|
||||||
*tdp_actions = stringify_collection_list (&tracepoint_list, &tdp_buff);
|
*tdp_actions = stringify_collection_list (&tracepoint_list, tdp_buff);
|
||||||
*stepping_actions = stringify_collection_list (&stepping_list, &step_buff);
|
*stepping_actions = stringify_collection_list (&stepping_list, step_buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char target_buf[2048];
|
static char target_buf[2048];
|
||||||
@ -2435,13 +2435,13 @@ _initialize_tracepoint ()
|
|||||||
if (tracepoint_list.list == NULL)
|
if (tracepoint_list.list == NULL)
|
||||||
{
|
{
|
||||||
tracepoint_list.listsize = 128;
|
tracepoint_list.listsize = 128;
|
||||||
tracepoint_list.list = xmalloc
|
tracepoint_list.list = (struct memrange *) xmalloc
|
||||||
(tracepoint_list.listsize * sizeof (struct memrange));
|
(tracepoint_list.listsize * sizeof (struct memrange));
|
||||||
}
|
}
|
||||||
if (stepping_list.list == NULL)
|
if (stepping_list.list == NULL)
|
||||||
{
|
{
|
||||||
stepping_list.listsize = 128;
|
stepping_list.listsize = 128;
|
||||||
stepping_list.list = xmalloc
|
stepping_list.list = (struct memrange *) xmalloc
|
||||||
(stepping_list.listsize * sizeof (struct memrange));
|
(stepping_list.listsize * sizeof (struct memrange));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user