/* Renesas M32C target-dependent code for GDB, the GNU debugger.
- Copyright 2004-2005, 2007-2012 Free Software Foundation, Inc.
+ Copyright (C) 2004-2014 Free Software Foundation, Inc.
This file is part of GDB.
#include <stdarg.h>
-#if defined (HAVE_STRING_H)
#include <string.h>
-#endif
-
#include "gdb_assert.h"
#include "elf-bfd.h"
#include "elf/m32c.h"
#include "reggroups.h"
#include "prologue-value.h"
#include "target.h"
+#include "objfiles.h"
\f
/* The m32c tdep structure. */
TYPE_UNSIGNED (tdep->ptr_voyd) = 1;
tdep->func_voyd = lookup_function_type (tdep->voyd);
- sprintf (type_name, "%s_data_addr_t",
- gdbarch_bfd_arch_info (arch)->printable_name);
+ xsnprintf (type_name, sizeof (type_name), "%s_data_addr_t",
+ gdbarch_bfd_arch_info (arch)->printable_name);
tdep->data_addr_reg_type
= arch_type (arch, TYPE_CODE_PTR, data_addr_reg_bits / TARGET_CHAR_BIT,
xstrdup (type_name));
TYPE_TARGET_TYPE (tdep->data_addr_reg_type) = tdep->voyd;
TYPE_UNSIGNED (tdep->data_addr_reg_type) = 1;
- sprintf (type_name, "%s_code_addr_t",
- gdbarch_bfd_arch_info (arch)->printable_name);
+ xsnprintf (type_name, sizeof (type_name), "%s_code_addr_t",
+ gdbarch_bfd_arch_info (arch)->printable_name);
tdep->code_addr_reg_type
= arch_type (arch, TYPE_CODE_PTR, code_addr_reg_bits / TARGET_CHAR_BIT,
xstrdup (type_name));
static enum return_value_convention
m32c_return_value (struct gdbarch *gdbarch,
- struct type *func_type,
+ struct value *function,
struct type *valtype,
struct regcache *regcache,
gdb_byte *readbuf,
/* Everything else is passed in mem0, using as many bytes as
needed. This is not what the Renesas tools do, but it's
what GCC does at the moment. */
- struct minimal_symbol *mem0
+ struct bound_minimal_symbol mem0
= lookup_minimal_symbol ("mem0", NULL, NULL);
- if (! mem0)
+ if (! mem0.minsym)
error (_("The return value is stored in memory at 'mem0', "
"but GDB cannot find\n"
"its address."));
- read_memory (SYMBOL_VALUE_ADDRESS (mem0), readbuf, valtype_len);
+ read_memory (BMSYMBOL_VALUE_ADDRESS (mem0), readbuf, valtype_len);
}
}
/* Everything else is passed in mem0, using as many bytes as
needed. This is not what the Renesas tools do, but it's
what GCC does at the moment. */
- struct minimal_symbol *mem0
+ struct bound_minimal_symbol mem0
= lookup_minimal_symbol ("mem0", NULL, NULL);
- if (! mem0)
+ if (! mem0.minsym)
error (_("The return value is stored in memory at 'mem0', "
"but GDB cannot find\n"
" its address."));
- write_memory (SYMBOL_VALUE_ADDRESS (mem0),
- (char *) writebuf, valtype_len);
+ write_memory (BMSYMBOL_VALUE_ADDRESS (mem0), writebuf, valtype_len);
}
}
if (target_code == TYPE_CODE_FUNC || target_code == TYPE_CODE_METHOD)
{
- char *func_name;
+ const char *func_name;
char *tramp_name;
- struct minimal_symbol *tramp_msym;
+ struct bound_minimal_symbol tramp_msym;
/* Try to find a linker symbol at this address. */
- struct minimal_symbol *func_msym = lookup_minimal_symbol_by_pc (addr);
+ struct bound_minimal_symbol func_msym
+ = lookup_minimal_symbol_by_pc (addr);
- if (! func_msym)
+ if (! func_msym.minsym)
error (_("Cannot convert code address %s to function pointer:\n"
"couldn't find a symbol at that address, to find trampoline."),
paddress (gdbarch, addr));
- func_name = SYMBOL_LINKAGE_NAME (func_msym);
+ func_name = MSYMBOL_LINKAGE_NAME (func_msym.minsym);
tramp_name = xmalloc (strlen (func_name) + 5);
strcpy (tramp_name, func_name);
strcat (tramp_name, ".plt");
the name any more. */
xfree (tramp_name);
- if (! tramp_msym)
+ if (! tramp_msym.minsym)
{
CORE_ADDR ptrval;
else
{
/* The trampoline's address is our pointer. */
- addr = SYMBOL_VALUE_ADDRESS (tramp_msym);
+ addr = BMSYMBOL_VALUE_ADDRESS (tramp_msym);
}
}
{
/* See if there is a minimal symbol at that address whose name is
"NAME.plt". */
- struct minimal_symbol *ptr_msym = lookup_minimal_symbol_by_pc (ptr);
+ struct bound_minimal_symbol ptr_msym = lookup_minimal_symbol_by_pc (ptr);
- if (ptr_msym)
+ if (ptr_msym.minsym)
{
- char *ptr_msym_name = SYMBOL_LINKAGE_NAME (ptr_msym);
+ const char *ptr_msym_name = MSYMBOL_LINKAGE_NAME (ptr_msym.minsym);
int len = strlen (ptr_msym_name);
if (len > 4
&& strcmp (ptr_msym_name + len - 4, ".plt") == 0)
{
- struct minimal_symbol *func_msym;
+ struct bound_minimal_symbol func_msym;
/* We have a .plt symbol; try to find the symbol for the
corresponding function.
/* If we do have such a symbol, return its value as the
function's true address. */
- if (func_msym)
- ptr = SYMBOL_VALUE_ADDRESS (func_msym);
+ if (func_msym.minsym)
+ ptr = BMSYMBOL_VALUE_ADDRESS (func_msym);
}
}
else
{
ptr_msym = lookup_minimal_symbol_by_pc ((aspace << 16) | ptr);
- if (ptr_msym)
+ if (ptr_msym.minsym)
ptr |= aspace << 16;
}
}
LONGEST *frame_offset)
{
const char *name;
- CORE_ADDR func_addr, func_end, sal_end;
+ CORE_ADDR func_addr, func_end;
struct m32c_prologue p;
struct regcache *regcache = get_current_regcache ();