diff options
| author | Roland McGrath <[email protected]> | 2009-09-15 19:16:18 -0700 |
|---|---|---|
| committer | Roland McGrath <[email protected]> | 2009-09-16 00:41:28 -0700 |
| commit | f4605b3c02dfe60d0474f44967275794b85b1d5c (patch) | |
| tree | 16b094191b1b66512041373ed41ee2adb8e66682 /tests | |
| parent | a417dd336d731f8fc083c31ae485df0b555ab881 (diff) | |
print-die.cc: Grok --refs-shared-cu, --refs-shared-file options to share the refs_map across CUs or across files.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ChangeLog | 5 | ||||
| -rw-r--r-- | tests/print-die.cc | 42 |
2 files changed, 38 insertions, 9 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index 7316f5cd..a11de050 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +2009-09-15 Roland McGrath <[email protected]> + + * print-die.cc: Grok --refs-shared-cu, --refs-shared-file options + to share the refs_map across CUs or across files. + 2009-08-28 Roland McGrath <[email protected]> * run-dwarfcmp-self.sh: Test dwarfcmp-test binary too. diff --git a/tests/print-die.cc b/tests/print-die.cc index 6816632a..b472a270 100644 --- a/tests/print-die.cc +++ b/tests/print-die.cc @@ -50,6 +50,8 @@ static bool elide_refs; static bool dump_refs; static bool no_print; static bool output_stats; +static bool refs_shared_cu; +static bool refs_shared_file; static enum { copy_none, copy_edit, copy_output } make_copy; @@ -88,6 +90,20 @@ print_die_main (int &argc, char **&argv, unsigned int &depth) ++argv; } + if (argc > 1 && !strcmp (argv[1], "--refs-shared-cu")) + { + refs_shared_cu = true; + --argc; + ++argv; + } + + if (argc > 1 && !strcmp (argv[1], "--refs-shared-file")) + { + refs_shared_file = refs_shared_cu = true; + --argc; + ++argv; + } + if (argc > 1 && !strcmp (argv[1], "--sort-attrs")) { sort_attrs = true; @@ -277,20 +293,16 @@ dump_nth (pair<int, int> p) template<typename file> static void -print_cu (const typename file::compile_unit &cu, const unsigned int limit) +print_cu (const typename file::compile_unit &cu, const unsigned int limit, + refs_map &refs) { - const typename file::debug_info_entry &die = cu; - // static_cast<const typename file::debug_info_entry &> (cu), - - refs_map refs; + const typename file::debug_info_entry &die + = static_cast<const typename file::debug_info_entry &> (cu); if (!print_offset && !elide_refs) prewalk_die<file> (die, refs); print_die<file> (die, 1, limit, refs); - - if (dump_refs) - for_each (nth_ref.begin (), nth_ref.end (), dump_nth); } template<typename file> @@ -300,9 +312,21 @@ print_file (const file &dw, const unsigned int limit) if (no_print) return; + static refs_map common_refs; + refs_map file_refs; + for (typename file::compile_units::const_iterator i = dw.compile_units ().begin (); i != dw.compile_units ().end (); ++i) - print_cu<file> (*i, limit); + if (refs_shared_cu) + print_cu<file> (*i, limit, refs_shared_file ? common_refs : file_refs); + else + { + refs_map refs; + print_cu<file> (*i, limit, refs); + } + + if (dump_refs) + for_each (nth_ref.begin (), nth_ref.end (), dump_nth); } template<typename file> |
