#include <sys/stat.h>
#include <ctype.h>
#include <time.h>
-#include <sys/time.h>
+#include "gdb_sys_time.h"
#include "psymtab.h"
int i;
/* `+ 1' for the NULL terminator. */
- array = xmalloc (sizeof (*array) * (addrs->num_sections + 1));
+ array = XNEWVEC (struct other_sections *, addrs->num_sections + 1);
for (i = 0; i < addrs->num_sections; i++)
array[i] = &addrs->other[i];
array[i] = NULL;
/* Now create ADDRS_TO_ABFD_ADDRS from ADDRS_SORTED and
ABFD_ADDRS_SORTED. */
- addrs_to_abfd_addrs = xzalloc (sizeof (*addrs_to_abfd_addrs)
- * addrs->num_sections);
+ addrs_to_abfd_addrs = XCNEWVEC (struct other_sections *, addrs->num_sections);
make_cleanup (xfree, addrs_to_abfd_addrs);
while (*addrs_sorted)
objfile->num_sections = num_sections;
objfile->section_offsets
- = obstack_alloc (&objfile->objfile_obstack, size);
+ = (struct section_offsets *) obstack_alloc (&objfile->objfile_obstack,
+ size);
memset (objfile->section_offsets, 0, size);
return;
}
if (canon_dir != NULL && strlen (canon_dir) > i)
i = strlen (canon_dir);
- debugfile = xmalloc (strlen (debug_file_directory) + 1
- + i
- + strlen (DEBUG_SUBDIRECTORY)
- + strlen ("/")
- + strlen (debuglink)
- + 1);
+ debugfile
+ = (char *) xmalloc (strlen (debug_file_directory) + 1
+ + i
+ + strlen (DEBUG_SUBDIRECTORY)
+ + strlen ("/")
+ + strlen (debuglink)
+ + 1);
/* First try in the same directory as the original file. */
strcpy (debugfile, dir);
if (lang == language_unknown)
{
char *name = main_name ();
- struct symbol *sym = lookup_symbol (name, NULL, VAR_DOMAIN, NULL);
+ struct symbol *sym = lookup_symbol (name, NULL, VAR_DOMAIN, NULL).symbol;
if (sym != NULL)
lang = SYMBOL_LANGUAGE (sym);
if (count)
{
/* We need to quote this string so buildargv can pull it apart. */
- char *temp = xmalloc (strlen (arg) + count + 1 );
+ char *temp = (char *) xmalloc (strlen (arg) + count + 1 );
char *ptemp = temp;
char *prev;
might add a verify_memory() method to the target vector and
then use that. remote.c could implement that method using
the ``qCRC'' packet. */
- gdb_byte *check = xmalloc (bytes);
+ gdb_byte *check = (gdb_byte *) xmalloc (bytes);
struct cleanup *verify_cleanups = make_cleanup (xfree, check);
if (target_read_memory (args->lma, check, bytes) != 0)
new_request = VEC_safe_push (memory_write_request_s,
args->requests, NULL);
memset (new_request, 0, sizeof (struct memory_write_request));
- section_data = xcalloc (1, sizeof (struct load_progress_section_data));
+ section_data = XCNEW (struct load_progress_section_data);
new_request->begin = bfd_section_lma (abfd, asec) + args->load_offset;
new_request->end = new_request->begin + size; /* FIXME Should size
be in instead? */
- new_request->data = xmalloc (size);
+ new_request->data = (gdb_byte *) xmalloc (size);
new_request->baton = section_data;
buffer = new_request->data;
struct cleanup *my_cleanups = make_cleanup (null_cleanup, NULL);
num_sect_opts = 16;
- sect_opts = (struct sect_opt *) xmalloc (num_sect_opts
- * sizeof (struct sect_opt));
+ sect_opts = XNEWVEC (struct sect_opt, num_sect_opts);
dont_repeat ();
do it *after* the obstack has been initialized. */
set_objfile_per_bfd (objfile);
- objfile->original_name = obstack_copy0 (&objfile->objfile_obstack,
- original_name,
- strlen (original_name));
+ objfile->original_name
+ = (char *) obstack_copy0 (&objfile->objfile_obstack, original_name,
+ strlen (original_name));
/* Reset the sym_fns pointer. The ELF reader can change it
based on whether .gdb_index is present, and we need it to
if (fl_table_next >= fl_table_size)
{
fl_table_size += 10;
- filename_language_table =
- xrealloc (filename_language_table,
- fl_table_size * sizeof (*filename_language_table));
+ filename_language_table = XRESIZEVEC (filename_language,
+ filename_language_table,
+ fl_table_size);
}
filename_language_table[fl_table_next].ext = xstrdup (ext);
{
fl_table_size = 20;
fl_table_next = 0;
- filename_language_table =
- xmalloc (fl_table_size * sizeof (*filename_language_table));
+ filename_language_table = XNEWVEC (filename_language, fl_table_size);
+
add_filename_language (".c", language_c);
add_filename_language (".d", language_d);
add_filename_language (".C", language_cplus);
Just save the basename to avoid path issues (too long for display,
relative vs absolute, etc.). */
saved_name = lbasename (name);
- cu->name = obstack_copy0 (&objfile->objfile_obstack, saved_name,
- strlen (saved_name));
+ cu->name
+ = (const char *) obstack_copy0 (&objfile->objfile_obstack, saved_name,
+ strlen (saved_name));
COMPUNIT_DEBUGFORMAT (cu) = "unknown";
In this simple implementation, the target data structures are as follows:
unsigned _novlys; /# number of overlay sections #/
unsigned _ovly_table[_novlys][4] = {
- {VMA, SIZE, LMA, MAPPED}, /# one entry per overlay section #/
+ {VMA, OSIZE, LMA, MAPPED}, /# one entry per overlay section #/
{..., ..., ..., ...},
}
unsigned _novly_regions; /# number of overlay regions #/
unsigned _ovly_region_table[_novly_regions][3] = {
- {VMA, SIZE, MAPPED_TO_LMA}, /# one entry per overlay region #/
+ {VMA, OSIZE, MAPPED_TO_LMA}, /# one entry per overlay region #/
{..., ..., ...},
}
These functions will attempt to update GDB's mappedness state in the
static CORE_ADDR cache_ovly_table_base = 0;
enum ovly_index
{
- VMA, SIZE, LMA, MAPPED
+ VMA, OSIZE, LMA, MAPPED
};
/* Throw away the cached copy of _ovly_table. */
int len, int size, enum bfd_endian byte_order)
{
/* FIXME (alloca): Not safe if array is very large. */
- gdb_byte *buf = alloca (len * size);
+ gdb_byte *buf = (gdb_byte *) alloca (len * size);
int i;
read_memory (memaddr, buf, len * size);
cache_novlys = read_memory_integer (BMSYMBOL_VALUE_ADDRESS (novlys_msym),
4, byte_order);
cache_ovly_table
- = (void *) xmalloc (cache_novlys * sizeof (*cache_ovly_table));
+ = (unsigned int (*)[4]) xmalloc (cache_novlys * sizeof (*cache_ovly_table));
cache_ovly_table_base = BMSYMBOL_VALUE_ADDRESS (ovly_table_msym);
read_target_long_array (cache_ovly_table_base,
(unsigned int *) cache_ovly_table,
for (i = 0; i < cache_novlys; i++)
if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect)
&& cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect)
- /* && cache_ovly_table[i][SIZE] == size */ )
+ /* && cache_ovly_table[i][OSIZE] == size */ )
{
read_target_long_array (cache_ovly_table_base + i * word_size,
(unsigned int *) cache_ovly_table[i],
4, word_size, byte_order);
if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect)
&& cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect)
- /* && cache_ovly_table[i][SIZE] == size */ )
+ /* && cache_ovly_table[i][OSIZE] == size */ )
{
osect->ovly_mapped = cache_ovly_table[i][MAPPED];
return 1;
for (i = 0; i < cache_novlys; i++)
if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect)
&& cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect)
- /* && cache_ovly_table[i][SIZE] == size */ )
+ /* && cache_ovly_table[i][OSIZE] == size */ )
{ /* obj_section matches i'th entry in ovly_table. */
osect->ovly_mapped = cache_ovly_table[i][MAPPED];
break; /* finished with inner for loop: break out. */