/* Renesas M32C target-dependent code for GDB, the GNU debugger.
- Copyright 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright 2004, 2005, 2007, 2008, 2009, 2010, 2011
+ Free Software Foundation, Inc.
This file is part of GDB.
break;
default:
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected mach");
}
/* The builtin_type_mumble variables are sometimes uninitialized when
this is called, so we avoid using them. */
tdep->voyd = arch_type (arch, TYPE_CODE_VOID, 1, "void");
tdep->ptr_voyd
- = arch_type (arch, TYPE_CODE_PTR, gdbarch_ptr_bit (arch), NULL);
+ = arch_type (arch, TYPE_CODE_PTR, gdbarch_ptr_bit (arch) / TARGET_CHAR_BIT,
+ NULL);
TYPE_TARGET_TYPE (tdep->ptr_voyd) = tdep->voyd;
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);
tdep->data_addr_reg_type
- = arch_type (arch, TYPE_CODE_PTR, data_addr_reg_bits, xstrdup (type_name));
+ = 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);
tdep->code_addr_reg_type
- = arch_type (arch, TYPE_CODE_PTR, code_addr_reg_bits, xstrdup (type_name));
+ = arch_type (arch, TYPE_CODE_PTR, code_addr_reg_bits / TARGET_CHAR_BIT,
+ xstrdup (type_name));
TYPE_TARGET_TYPE (tdep->code_addr_reg_type) = tdep->func_voyd;
TYPE_UNSIGNED (tdep->code_addr_reg_type) = 1;
case 0xf: sd.addr = pv_constant (m32c_udisp16 (st)); break;
default:
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected srcdest4");
}
return sd;
case 0x0f: sd.addr = pv_constant (m32c_udisp16 (st)); break;
case 0x0e: sd.addr = pv_constant (m32c_udisp24 (st)); break;
default:
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected sd23");
}
if (ind)
return 0;
default:
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected prologue kind");
}
}
= lookup_minimal_symbol ("mem0", NULL, NULL);
if (! mem0)
- error ("The return value is stored in memory at 'mem0', "
- "but GDB cannot find\n"
- "its address.");
+ 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);
}
}
= lookup_minimal_symbol ("mem0", NULL, NULL);
if (! mem0)
- error ("The return value is stored in memory at 'mem0', "
- "but GDB cannot find\n"
- " its address.");
+ 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);
}
/* What we have now is the address of a jump instruction.
What we need is the destination of that jump.
- The opcode is 1 byte, and the destination is the next 3 bytes.
- */
+ The opcode is 1 byte, and the destination is the next 3 bytes. */
+
target = read_memory_unsigned_integer (target + 1, 3, byte_order);
return target;
}
struct minimal_symbol *func_msym = lookup_minimal_symbol_by_pc (addr);
if (! func_msym)
- error ("Cannot convert code address %s to function pointer:\n"
- "couldn't find a symbol at that address, to find trampoline.",
+ 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);
xfree (tramp_name);
if (! tramp_msym)
- error ("Cannot convert code address %s to function pointer:\n"
- "couldn't find trampoline named '%s.plt'.",
- paddress (gdbarch, addr), func_name);
+ {
+ CORE_ADDR ptrval;
+
+ /* No PLT entry found. Mask off the upper bits of the address
+ to make a pointer. As noted in the warning to the user
+ below, this value might be useful if converted back into
+ an address by GDB, but will otherwise, almost certainly,
+ be garbage.
+
+ Using this masked result does seem to be useful
+ in gdb.cp/cplusfuncs.exp in which ~40 FAILs turn into
+ PASSes. These results appear to be correct as well.
+
+ We print a warning here so that the user can make a
+ determination about whether the result is useful or not. */
+ ptrval = addr & 0xffff;
+
+ warning (_("Cannot convert code address %s to function pointer:\n"
+ "couldn't find trampoline named '%s.plt'.\n"
+ "Returning pointer value %s instead; this may produce\n"
+ "a useful result if converted back into an address by GDB,\n"
+ "but will most likely not be useful otherwise.\n"),
+ paddress (gdbarch, addr), func_name,
+ paddress (gdbarch, ptrval));
+
+ addr = ptrval;
- /* The trampoline's address is our pointer. */
- addr = SYMBOL_VALUE_ADDRESS (tramp_msym);
+ }
+ else
+ {
+ /* The trampoline's address is our pointer. */
+ addr = SYMBOL_VALUE_ADDRESS (tramp_msym);
+ }
}
store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order, addr);
ptr = SYMBOL_VALUE_ADDRESS (func_msym);
}
}
+ else
+ {
+ int aspace;
+
+ for (aspace = 1; aspace <= 15; aspace++)
+ {
+ ptr_msym = lookup_minimal_symbol_by_pc ((aspace << 16) | ptr);
+
+ if (ptr_msym)
+ ptr |= aspace << 16;
+ }
+ }
}
return ptr;
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (!find_pc_partial_function (pc, &name, &func_addr, &func_end))
- internal_error (__FILE__, __LINE__, _("No virtual frame pointer available"));
+ internal_error (__FILE__, __LINE__,
+ _("No virtual frame pointer available"));
m32c_analyze_prologue (gdbarch, func_addr, pc, &p);
switch (p.kind)
}
/* Sanity check */
if (*frame_regnum > gdbarch_num_regs (gdbarch))
- internal_error (__FILE__, __LINE__, _("No virtual frame pointer available"));
+ internal_error (__FILE__, __LINE__,
+ _("No virtual frame pointer available"));
}
\f
They may be in the dwarf2 cfi code in GDB, or they may be in
the debug info emitted by the upstream toolchain. I don't
know which, but I do know that the prologue analyzer works better.
- MVS 04/13/06
- */
+ MVS 04/13/06 */
dwarf2_append_sniffers (arch);
#endif
frame_unwind_append_unwinder (arch, &m32c_unwind);
/* m32c function boundary addresses are not necessarily even.
Therefore, the `vbit', which indicates a pointer to a virtual
member function, is stored in the delta field, rather than as
- the low bit of a function pointer address.
+ the low bit of a function pointer address.
In order to verify this, see the definition of
TARGET_PTRMEMFUNC_VBIT_LOCATION in gcc/defaults.h along with the