#include "array_t.h"
#define NDEBUG
#else
-#include "array.h"
+#include "array_t.h"
#endif
#include "entity_t.h"
#include "irloop_t.h"
#include "irextbb_t.h"
#include "irprog_t.h"
+#include "compound_path_t.h"
#include "tpop_t.h"
#include "strcalc.h"
#include "fltcalc.h"
#define ADD_ADR(p, off) ((void *)((char *)(p) + (off)))
/** debug output */
-static void debug(char *fmt, ...) {
+static void debug(char *fmt, ...)
+{
va_list ap;
char buf[1024];
/**
* return the size of a firm object
*/
-int get_firm_object_size(firm_kind kind) {
+int get_firm_object_size(firm_kind kind)
+{
switch (kind) {
case k_entity: /* an entity */
return sizeof(ir_entity);
/**
* Format an ident
*/
-HRESULT format_ident(DEBUGHELPER *pHelper, const void *address, char *pResult, size_t max) {
+HRESULT format_ident(DEBUGHELPER *pHelper, const void *address, char *pResult, size_t max)
+{
set_entry *data = NULL;
set_entry id;
size_t len, slen;
Y(enumeration, "enum");
Y(pointer, "ptr");
Y(primitive, "prim");
- X(id);
X(none);
X(unknown);
default:
*
* @param type the address of the type in debuggee's space
*/
-static HRESULT is_global_type(DEBUGHELPER *pHelper, const void *type, int *flag) {
+static HRESULT is_global_type(DEBUGHELPER *pHelper, const void *type, int *flag)
+{
ir_type tp;
*flag = 0;
/**
* format an entity
*/
-static HRESULT format_entity(DEBUGHELPER *pHelper, int nBase, const void *addr, char *pResult, size_t max, int top) {
+static HRESULT format_entity(DEBUGHELPER *pHelper, int nBase, const void *addr, char *pResult, size_t max, int top)
+{
ir_entity ent;
ir_type owner;
char name[256];
return S_OK;
} /* format_entity */
+/**
+ * format an ir_mode
+ */
+static HRESULT format_mode(DEBUGHELPER *pHelper, const void *addr, char *pResult, size_t max)
+{
+ ir_mode mode;
+
+ if (copy_from_debuggee(addr, pHelper, &mode, sizeof(mode)) != S_OK)
+ return E_FAIL;
+ if (format_ident(pHelper, mode.name, pResult, max) != S_OK)
+ return E_FAIL;
+ return S_OK;
+} /* format_mode */
+
/**
* format a type
*/
-static HRESULT format_type(DEBUGHELPER *pHelper, int nBase, const void *addr, char *pResult, size_t max, int top) {
+static HRESULT format_type(DEBUGHELPER *pHelper, int nBase, const void *addr, char *pResult, size_t max, int top)
+{
ir_type tp;
char name[256];
_tcsncat(pResult, " ", max);
}
- if (format_ident(pHelper, tp.name, name, sizeof(name)) != S_OK)
- return E_FAIL;
+ name[0] = '\0';
+ if (tp.name) {
+ if (format_ident(pHelper, tp.name, name, sizeof(name)) != S_OK)
+ return E_FAIL;
+ } else {
+ if (format_mode(pHelper, tp.mode, name, sizeof(name)) != S_OK)
+ return E_FAIL;
+ }
_tcsncat(pResult, name, max);
switch (nBase) {
/**
* format an irg
*/
-static HRESULT format_irg(DEBUGHELPER *pHelper, int nBase, const void *addr, char *pResult, size_t max, int top) {
+static HRESULT format_irg(DEBUGHELPER *pHelper, int nBase, const void *addr, char *pResult, size_t max, int top)
+{
ir_graph irg;
char name[256];
/**
* format an ir_op
*/
-HRESULT format_op(DEBUGHELPER *pHelper, const void *addr, char *pResult, size_t max) {
+HRESULT format_op(DEBUGHELPER *pHelper, const void *addr, char *pResult, size_t max)
+{
ir_op op;
if (copy_from_debuggee(addr, pHelper, &op, sizeof(op)) != S_OK)
return S_OK;
} /* format_op */
-/**
- * format an ir_mode
- */
-static HRESULT format_mode(DEBUGHELPER *pHelper, const void *addr, char *pResult, size_t max) {
- ir_mode mode;
-
- if (copy_from_debuggee(addr, pHelper, &mode, sizeof(mode)) != S_OK)
- return E_FAIL;
- if (format_ident(pHelper, mode.name, pResult, max) != S_OK)
- return E_FAIL;
- return S_OK;
-} /* format_mode */
-
/** get a temporary string */
#define get_string(str) \
do { \
s[len] = '\0'; \
str = s; \
} \
-} while(0)
+} while (0)
/**
* format a tarval
/**
* format an ir_node
*/
-static HRESULT format_node(DEBUGHELPER *pHelper, int nBase, const void *addr, char *pResult, size_t max, int top) {
+static HRESULT format_node(DEBUGHELPER *pHelper, int nBase, const void *addr, char *pResult, size_t max, int top)
+{
ir_node n;
char name[256];
ir_op op;
/* show show node attributes */
switch (op.code) {
case iro_Const:
- if (format_tarval(pHelper, nBase, n.attr.con.tv, name, sizeof(name)) != S_OK) {
+ if (format_tarval(pHelper, nBase, n.attr.con.tarval, name, sizeof(name)) != S_OK) {
_tcsncat(pResult, "<???>", max);
}
else {
case iro_SymConst:
_tcsncat(pResult, "<", max);
switch (n.attr.symc.kind) {
- case symconst_type_tag:
- _tcsncat(pResult, "TAG:", max);
- if (format_type(pHelper, nBase, n.attr.symc.sym.type_p, name, sizeof(name), 0) != S_OK)
- return E_FAIL;
- _tcsncat(pResult, name, max);
- break;
case symconst_type_size:
_tcsncat(pResult, "SIZE:", max);
if (format_type(pHelper, nBase, n.attr.symc.sym.type_p, name, sizeof(name), 0) != S_OK)
return E_FAIL;
_tcsncat(pResult, name, max);
break;
- case symconst_addr_name:
- _tcsncat(pResult, "NAME:", max);
- if (format_ident(pHelper, n.attr.symc.sym.ident_p, name, sizeof(name)) != S_OK)
- return E_FAIL;
- _tcsncat(pResult, name, max);
- break;
case symconst_addr_ent:
_tcsncat(pResult, "ENT:", max);
if (format_entity(pHelper, nBase, n.attr.symc.sym.entity_p, name, sizeof(name), 0) != S_OK)
break;
case iro_Sel:
_tcsncat(pResult, "<", max);
- if (format_entity(pHelper, nBase, n.attr.sel.ent, name, sizeof(name), 0) != S_OK)
+ if (format_entity(pHelper, nBase, n.attr.sel.entity, name, sizeof(name), 0) != S_OK)
return E_FAIL;
_tcsncat(pResult, name, max);
_tcsncat(pResult, ">", max);
break;
case iro_Cast:
_tcsncat(pResult, "<", max);
- if (format_type(pHelper, nBase, n.attr.cast.totype, name, sizeof(name), 0) != S_OK)
+ if (format_type(pHelper, nBase, n.attr.cast.type, name, sizeof(name), 0) != S_OK)
return E_FAIL;
_tcsncat(pResult, name, max);
_tcsncat(pResult, ">", max);
break;
case iro_CopyB:
_tcsncat(pResult, "<", max);
- if (format_type(pHelper, nBase, n.attr.copyb.data_type, name, sizeof(name), 0) != S_OK)
+ if (format_type(pHelper, nBase, n.attr.copyb.type, name, sizeof(name), 0) != S_OK)
return E_FAIL;
_tcsncat(pResult, name, max);
_tcsncat(pResult, ">", max);
/**
* format an extended block
*/
-static HRESULT format_extblk(DEBUGHELPER *pHelper, int nBase, const void *addr, char *pResult, size_t max){
+static HRESULT format_extblk(DEBUGHELPER *pHelper, int nBase, const void *addr, char *pResult, size_t max)
+{
ir_extblk extbb;
ir_arr_descr blocks;
ir_node *blks = NULL;
pset_Element *iter_tail; /**< non-NULL while iterating over elts */
pset_Element *free_list; /**< list of free Elements */
struct obstack obst; /**< obstack for allocation all data */
-#ifdef STATS
- int naccess, ncollision, ndups;
- int max_chain_len;
-#endif
-#ifdef DEBUG
- const char *tag; /**< an optionally tag for distinguishing sets */
-#endif
};
typedef struct set_element {
unsigned iter_i, iter_j;
set_Element *iter_tail; /**< non-NULL while iterating over elts */
struct obstack obst; /**< obstack for allocation all data */
-#ifdef STATS
- int naccess, ncollision, ndups;
- int max_chain_len;
-#endif
-#ifdef DEBUG
- const char *tag; /**< an optionally tag for distinguishing sets */
-#endif
};
/**
* Find the longest chain of a pset
*/
static HRESULT find_longest_pset_chain(DEBUGHELPER *pHelper, pset *set,
- int *chains, int *lenght, size_t *size) {
+ int *chains, int *lenght, size_t *size)
+{
unsigned i, j;
pset_Segment *seg, *curr;
pset_Element elem;
* Find the longest chain of a set
*/
static HRESULT find_longest_set_chain(DEBUGHELPER *pHelper, set *set,
- int *chains, int *lenght, size_t *size) {
+ int *chains, int *lenght, size_t *size)
+{
unsigned i, j;
set_Segment *seg, *curr;
set_Element elem;
} /* format_pdeq */
/** show the first 2 units */
-static HRESULT fill_bits(DEBUGHELPER *pHelper, bitset_t *bs, char *pResult) {
- bitset_pos_t i, units = bs->units;
+static HRESULT fill_bits(DEBUGHELPER *pHelper, bitset_t *bs, char *pResult)
+{
+ unsigned i, units = bs->size;
int l = 0, o = 0, breaked = 0;
unsigned j;
for (i = 0; i < units; ++i) {
- bitset_unit_t data;
+ unsigned data;
- if (copy_from_debuggee((void *)(BS_DATA(bs)[i]), pHelper, &data, sizeof(data)) != S_OK)
+ if (copy_from_debuggee((void *)(&bs->data[i]), pHelper, &data, sizeof(data)) != S_OK)
return E_FAIL;
for (j = 0; j < 32; ++j) {
{
bitset_t bs;
char name[256];
- bitset_pos_t l;
+ unsigned l;
if (copy_from_debuggee(address, pHelper, &bs, sizeof(bs)) != S_OK)
return E_FAIL;