#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <inttypes.h>
#include <assert.h>
#include "common.h"
#include "dwdebug.h"
#include "dwdebug_priv.h"
#include "memory-access.h"
#include <dwarf.h>
#include <gelf.h>
#include <elfutils/libebl.h>
#include <elfutils/libdw.h>
#include <elfutils/libdwfl.h>
Go to the source code of this file.
#define CONSUME |
( |
|
n | ) |
NEED (n); else len -= (n) |
#define INPLACE1 |
( |
|
OP, |
|
|
|
value |
|
) |
| |
Value:
if (overflowstack) \
overflowstack[stackdepth - 1] = \
overflowstack[stackdepth - 1] OP (
value); \
else \
stack[stackdepth - 1] = \
stack[stackdepth - 1] OP (
value); \
} while (0)
#define INPLACE1SIGNED |
( |
|
OP, |
|
|
|
value |
|
) |
| |
Value:
if (overflowstack) \
overflowstack[stackdepth - 1] = (Dwarf_Word) \
((int64_t)overflowstack[stackdepth - 1] OP (int64_t)(
value)); \
else \
stack[stackdepth - 1] = (Dwarf_Word) \
((int64_t)stack[stackdepth - 1] OP (int64_t)(
value)); \
} while (0)
#define INPLACE1UNARY |
( |
|
OP | ) |
|
Value:
if (overflowstack) \
overflowstack[stackdepth - 1] = \
OP overflowstack[stackdepth - 1]; \
else \
stack[stackdepth - 1] = \
OP stack[stackdepth - 1]; \
} while (0)
Value:
if (overflowstack) \
overflowstack[stackdepth - 2] = \
overflowstack[stackdepth - 2] OP overflowstack[stackdepth - 1]; \
else \
stack[stackdepth - 2] = \
stack[stackdepth - 1] OP stack[stackdepth - 2]; \
--stackdepth; \
} while (0)
#define NEED |
( |
|
n | ) |
if (len < (n)) goto errout |
Value:do { \
verror(
"op %s needed %d stack values, but only %d available!\n", \
known_ops[op],(n),stackdepth); \
goto errout; \
} \
} while (0)
#define verror(format,...)
#define ONLYOP |
( |
|
location, |
|
|
|
setter, |
|
|
|
... |
|
) |
| |
Value:if (start == (origdata + 1) &&
len == 0) { \
location_set_ ## setter((
location), ## __VA_ARGS__); \
goto out; \
} \
"unsupported %s op with other ops!\n",known_ops[op]); \
}
#define vdebug(devel, areas, flags, format,...)
#define OPCONSTS |
( |
|
size, |
|
|
|
tt |
|
) |
| |
Value:
s64 = (int64_t)*((tt *)data); \
#define vdebug(devel, areas, flags, format,...)
#define OPCONSTU |
( |
|
size, |
|
|
|
tt |
|
) |
| |
Value:
u64 = (uint64_t)*((tt *)data); \
#define vdebug(devel, areas, flags, format,...)
Value:((overflowstack) ? overflowstack[stackdepth - 1] \
: stack[stackdepth - 1])
Value:((overflowstack) ? overflowstack[stackdepth - 1 -
i] \
: stack[stackdepth - 1 -
i])
static uint64_t unsigned int i
Value:((overflowstack) ? overflowstack[--stackdepth] \
: stack[--stackdepth])
#define PRIxDwarfWord PRIx32 |
Value:do { \
if (overflowstack) { \
if (stackdepth == overflowstacklen) { \
(overflowstacklen + 4) * sizeof(Dwarf_Word)); \
overflowstacklen += 4; \
} \
overflowstack[stackdepth] =
value; \
} \
else if (stackdepth == (sizeof(stack) / sizeof(Dwarf_Word))) { \
overflowstacklen = stackdepth + 4; \
overflowstack =
calloc(overflowstacklen,
sizeof(Dwarf_Word)); \
memcpy(overflowstack,&stack,sizeof(stack)); \
overflowstack[stackdepth] =
value; \
} \
else { \
stack[stackdepth] =
value; \
} \
++stackdepth; \
} while (0)
void * realloc(void *ptr, size_t size)
void * calloc(size_t nmemb, size_t size)
#define SCONSUME |
( |
|
n | ) |
SNEED(n); else len -= (n) |
#define SNEED |
( |
|
n | ) |
if (len < (Dwarf_Word) (n)) goto errout |
#define SOPCONSTS |
( |
|
size, |
|
|
|
tt |
|
) |
| |
Value:
s64 = (int64_t)*((tt *)data); \
if (attr == DW_AT_data_member_location) {
\
ONLYOP(retval,member_offset,(int32_t)s64); \
} \
"assuming constXs is for loctype_addr!\n");
\
ONLYOP(retval,addr,(uint64_t)s64); \
}
#define vdebug(devel, areas, flags, format,...)
#define ONLYOP(location, setter,...)
#define SOPCONSTU |
( |
|
size, |
|
|
|
tt |
|
) |
| |
Value:
u64 = (uint64_t)*((tt *)data); \
if (attr == DW_AT_data_member_location) {
\
ONLYOP(retval,member_offset,(int32_t)u64); \
} \
"assuming constXu is for loctype_addr!\n");
\
}
#define vdebug(devel, areas, flags, format,...)
#define ONLYOP(location, setter,...)
struct location* dwarf_get_static_ops |
( |
struct symbol_root_dwarf * |
srd, |
|
|
const unsigned char * |
data, |
|
|
Dwarf_Word |
len, |
|
|
unsigned int |
attr |
|
) |
| |
const char* dwarf_op_string |
( |
unsigned int |
op | ) |
|