From ee723a374fe4ea5c30a533144aa4573412ca7fa1 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Tue, 27 Oct 2020 05:59:56 -0700 Subject: [PATCH] Make dwarf_pubnames_types example a bit more general --- examples/dwarf_pubnames_types.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/examples/dwarf_pubnames_types.py b/examples/dwarf_pubnames_types.py index 292c68e..a747874 100644 --- a/examples/dwarf_pubnames_types.py +++ b/examples/dwarf_pubnames_types.py @@ -39,19 +39,13 @@ def process_file(filename): else: print('%d entries found in .debug_pubnames' % len(pubnames)) - # try getting information on a global symbol. print('Trying pubnames example ...') - sym_name = 'main' - try: - entry = pubnames[sym_name] - except KeyError: - print('ERROR: No pubname entry found for ' + sym_name) - else: + for name, entry in pubnames.items(): print('%s: cu_ofs = %d, die_ofs = %d' % - (sym_name, entry.cu_ofs, entry.die_ofs)) + (name, entry.cu_ofs, entry.die_ofs)) # get the actual CU/DIE that has this information. - print('Fetching the actual die for %s ...' % sym_name) + print('Fetching the actual die for %s ...' % name) for cu in dwarfinfo.iter_CUs(): if cu.cu_offset == entry.cu_ofs: for die in cu.iter_DIEs(): -- 2.30.2