#define DWARF_DATA_ALIGN (-4)
#define DWARF_PC_REG (mono_hw_reg_to_dwarf_reg (ARMREG_LR))
#elif defined(TARGET_ARM64)
-#define NUM_REGS 32
+#define NUM_REGS 96
#define DWARF_DATA_ALIGN (-8)
/* LR */
#define DWARF_PC_REG 30
static int map_hw_reg_to_dwarf_reg [] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ /* v8..v15 */
+ 72, 73, 74, 75, 76, 77, 78, 79,
};
#elif defined (TARGET_X86)
-#ifdef __APPLE__
/*
- * LLVM seems to generate unwind info where esp is encoded as 5, and ebp as 4, ie see this line:
- * def ESP : RegisterWithSubRegs<"esp", [SP]>, DwarfRegNum<[-2, 5, 4]>;
- * in lib/Target/X86/X86RegisterInfo.td in the llvm sources.
+ * ebp and esp are swapped:
+ * http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-January/003101.html
*/
static int map_hw_reg_to_dwarf_reg [] = { 0, 1, 2, 3, 5, 4, 6, 7, 8 };
-#else
-static int map_hw_reg_to_dwarf_reg [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
-#endif
/* + 1 is for IP */
#define NUM_REGS X86_NREG + 1
#define DWARF_DATA_ALIGN (-4)
GSList *l;
MonoUnwindOp *op;
int loc;
- guint8 *buf, *p, *res;
+ guint8 buf [4096];
+ guint8 *p, *res;
- p = buf = g_malloc0 (4096);
+ p = buf;
loc = 0;
l = unwind_ops;
*out_len = p - buf;
res = g_malloc (p - buf);
memcpy (res, buf, p - buf);
- g_free (buf);
return res;
}
{
Loc locations [NUM_REGS];
guint8 reg_saved [NUM_REGS];
- int i, pos, reg, cfa_reg, cfa_offset, offset;
+ int i, pos, reg, cfa_reg = -1, cfa_offset = 0, offset;
guint8 *p;
guint8 *cfa_val;
UnwindState state_stack [1];
int state_stack_pos;
memset (reg_saved, 0, sizeof (reg_saved));
+ state_stack [0].cfa_reg = -1;
+ state_stack [0].cfa_offset = 0;
p = unwind_info;
pos = 0;
if (save_locations)
memset (save_locations, 0, save_locations_len * sizeof (mgreg_t*));
+ g_assert (cfa_reg != -1);
cfa_val = (guint8*)regs [mono_dwarf_reg_to_hw_reg (cfa_reg)] + cfa_offset;
for (i = 0; i < NUM_REGS; ++i) {
if (reg_saved [i] && locations [i].loc_type == LOC_OFFSET) {
i = cached_info_next;
if (cached_info_next >= cached_info_size) {
- MonoUnwindInfo **old_table, **new_table;
+ MonoUnwindInfo **new_table;
/*
* Avoid freeing the old table so mono_get_cached_unwind_info ()
* doesn't need locks/hazard pointers.
*/
- old_table = cached_info;
new_table = g_new0 (MonoUnwindInfo*, cached_info_size * 2);
memcpy (new_table, cached_info, cached_info_size * sizeof (MonoUnwindInfo*));
mono_unwind_decode_fde (guint8 *fde, guint32 *out_len, guint32 *code_len, MonoJitExceptionInfo **ex_info, guint32 *ex_info_len, gpointer **type_info, int *this_reg, int *this_offset)
{
guint8 *p, *cie, *fde_current, *fde_aug = NULL, *code, *fde_cfi, *cie_cfi;
- gint32 fde_len, cie_offset, pc_begin, pc_range, aug_len, fde_data_len;
+ gint32 fde_len, cie_offset, pc_begin, pc_range, aug_len;
gint32 cie_len, cie_id, cie_version, code_align, data_align, return_reg;
gint32 i, cie_aug_len, buf_len;
char *cie_aug_str;
* http://refspecs.freestandards.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html
*/
+ /* This is generated by JITDwarfEmitter::EmitEHFrame () */
+
*type_info = NULL;
*this_reg = -1;
*this_offset = -1;
aug_len = 0;
}
fde_cfi = p;
- fde_data_len = fde + 4 + fde_len - p;
if (code_len)
*code_len = pc_range;
res->this_reg = -1;
res->this_offset = -1;
- /* fde points to data emitted by LLVM in DwarfException::EmitMonoEHFrame () */
+ /* fde points to data emitted by LLVM in DwarfMonoException::EmitMonoEHFrame () */
p = fde;
has_aug = *p;
p ++;