/* CFI program execution.
- Copyright (C) 2009 Red Hat, Inc.
+ Copyright (C) 2009-2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
return copy;
}
-/* Returns a DWARF_E_* error code, usually NOERROR or INVALID_CFI. */
+/* Returns a DWARF_E_* error code, usually NOERROR or INVALID_CFI.
+ Frees *STATE on failure. */
static int
execute_cfi (Dwarf_CFI *cache,
const struct dwarf_cie *cie,
goto advance_loc;
case DW_CFA_set_loc:
- if (unlikely (read_encoded_value (cache, cie->fde_encoding, &program,
- &loc)))
- return INTUSE(dwarf_errno) ();
- break;
+ if (likely (!read_encoded_value (cache, cie->fde_encoding,
+ &program, &loc)))
+ break;
+ result = INTUSE(dwarf_errno) ();
+ goto out;
/* Now all following cases affect this row, but do not touch LOC.
These cases end with 'continue'. We only get out of the
cfi_assert (prev != NULL);
free (fs);
fs = prev;
+ continue;
}
- continue;
case DW_CFA_nop:
continue;
free (prev);
}
- if (result == DWARF_E_NOERROR)
+ if (likely (result == DWARF_E_NOERROR))
*state = fs;
+ else
+ free (fs);
return result;
}
cie->initial_instructions_end, false,
0, (Dwarf_Addr) -1l);
- if (unlikely (result != DWARF_E_NOERROR))
+ if (likely (result == DWARF_E_NOERROR))
{
- free (cie_fs);
- return result;
+ /* Now we have the initial state of things that all
+ FDEs using this CIE will start from. */
+ cie_fs->cache = cache;
+ cie->initial_state = cie_fs;
}
- /* Now we have the initial state of things that all
- FDEs using this CIE will start from. */
- cie_fs->cache = cache;
- cie->initial_state = cie_fs;
-
return result;
}
result = execute_cfi (cache, fde->cie, &fs,
fde->instructions, fde->instructions_end, false,
fde->start, address);
- if (unlikely (result != DWARF_E_NOERROR))
- free (fs);
- else
+ if (likely (result == DWARF_E_NOERROR))
*frame = fs;
}
return result;