diff options
| author | Petr Machata <[email protected]> | 2010-08-17 19:34:12 +0200 |
|---|---|---|
| committer | Petr Machata <[email protected]> | 2010-08-18 14:55:18 +0200 |
| commit | 3c5d0c0fc4671e32c05d0050959251fc16958e21 (patch) | |
| tree | 5c7e8c315344b9f85afe89d3be2ec45d1bd1835a /dwarflint/where.h | |
| parent | 566dd3f1f4c73e683e5a248da9785e21c47f9a16 (diff) | |
Move dwarflint to separate directory
Diffstat (limited to 'dwarflint/where.h')
| -rw-r--r-- | dwarflint/where.h | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/dwarflint/where.h b/dwarflint/where.h new file mode 100644 index 00000000..f8fd6c13 --- /dev/null +++ b/dwarflint/where.h @@ -0,0 +1,93 @@ +#ifndef DWARFLINT_WHERE_H +#define DWARFLINT_WHERE_H + +#include <stdint.h> +#include <stdlib.h> + +#ifdef __cplusplus +#include <iosfwd> +extern "C" +{ +#endif + +#define DEBUGINFO_SECTIONS \ + SEC (info) \ + SEC (abbrev) \ + SEC (aranges) \ + SEC (pubnames) \ + SEC (pubtypes) \ + SEC (str) \ + SEC (line) \ + SEC (loc) \ + SEC (mac) \ + SEC (ranges) + + enum section_id + { + sec_invalid = 0, + + /* Debuginfo sections: */ +#define SEC(n) sec_##n, + DEBUGINFO_SECTIONS + count_debuginfo_sections, +#undef SEC + + /* Non-debuginfo sections: */ + sec_rel = count_debuginfo_sections, + sec_rela, + + /* Non-sections: */ + sec_locexpr, /* Not a section, but a portion of file that + contains a location expression. */ + rel_value, /* For relocations, this denotes that the + relocation is applied to taget value, not a + section offset. */ + rel_address, /* Same as above, but for addresses. */ + rel_exec, /* Some as above, but we expect EXEC bit. */ + }; + + enum where_formatting + { + wf_plain = 0, /* Default formatting for given section. */ + wf_cudie, + }; + + struct where + { + enum section_id section; + enum where_formatting formatting; + uint64_t addr1; // E.g. a CU offset. + uint64_t addr2; // E.g. a DIE address. + uint64_t addr3; // E.g. an attribute. + struct where const *ref; // Related reference, e.g. an abbrev + // related to given DIE. + struct where const *next; // For forming "caused-by" chains. + }; + +# define WHERE(SECTION, NEXT) \ + ((struct where) \ + {(SECTION), wf_plain, \ + (uint64_t)-1, (uint64_t)-1, (uint64_t)-1, \ + NULL, NEXT}) + + extern const char *where_fmt (const struct where *wh, char *ptr); + extern void where_fmt_chain (const struct where *wh, const char *severity); + extern void where_reset_1 (struct where *wh, uint64_t addr); + extern void where_reset_2 (struct where *wh, uint64_t addr); + extern void where_reset_3 (struct where *wh, uint64_t addr); + +#ifdef __cplusplus +} + +#include <iostream> + +inline std::ostream & +operator << (std::ostream &os, where const &wh) +{ + os << where_fmt (&wh, NULL); + return os; +} + +#endif + +#endif//DWARFLINT_WHERE_H |
