Add option to not expand array elements
Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
parent
bd7272f365
commit
557ed8c84b
12
main.py
12
main.py
|
@ -15,6 +15,7 @@ configuration = {
|
||||||
'include_file_name': False,
|
'include_file_name': False,
|
||||||
'print_debug_info': False,
|
'print_debug_info': False,
|
||||||
'all_members': False,
|
'all_members': False,
|
||||||
|
'no_array_expand': False,
|
||||||
}
|
}
|
||||||
|
|
||||||
supported_types = [
|
supported_types = [
|
||||||
|
@ -295,12 +296,16 @@ class Bear():
|
||||||
|
|
||||||
self.flat_list.append(flat_entry)
|
self.flat_list.append(flat_entry)
|
||||||
|
|
||||||
if 'children' in entry:
|
if 'children' in entry and 'number_of_elements' not in entry:
|
||||||
for kid in entry['children']:
|
for kid in entry['children']:
|
||||||
self.pettanko(kid, flat_entry['name'])
|
self.pettanko(kid, flat_entry['name'])
|
||||||
|
|
||||||
if 'number_of_elements' in entry:
|
if 'number_of_elements' in entry:
|
||||||
for index in range(0, entry['number_of_elements']):
|
step = 1
|
||||||
|
if configuration['no_array_expand']:
|
||||||
|
step = entry['number_of_elements'] - 1
|
||||||
|
|
||||||
|
for index in range(0, entry['number_of_elements'], step):
|
||||||
kid = flat_entry.copy()
|
kid = flat_entry.copy()
|
||||||
kid['name'] = '{name}[{index}]'.format(name=flat_entry['name'], index=index)
|
kid['name'] = '{name}[{index}]'.format(name=flat_entry['name'], index=index)
|
||||||
|
|
||||||
|
@ -366,6 +371,8 @@ def main():
|
||||||
help='Print debug infor when parsing DWARF')
|
help='Print debug infor when parsing DWARF')
|
||||||
parser.add_argument('-a', '--all-members', dest='all_members', action='store_true',
|
parser.add_argument('-a', '--all-members', dest='all_members', action='store_true',
|
||||||
help='Print information of all children')
|
help='Print information of all children')
|
||||||
|
parser.add_argument('-e', '--no-array-expand', dest='no_array_expand', action='store_true',
|
||||||
|
help='Print only first and last array elements')
|
||||||
parser.add_argument('--version', action='version',
|
parser.add_argument('--version', action='version',
|
||||||
version='%(prog)s {version}'.format(version=SCRIPT_VERSION))
|
version='%(prog)s {version}'.format(version=SCRIPT_VERSION))
|
||||||
|
|
||||||
|
@ -374,6 +381,7 @@ def main():
|
||||||
configuration['include_file_name'] = args.include_file_name
|
configuration['include_file_name'] = args.include_file_name
|
||||||
configuration['print_debug_info'] = args.print_debug_info
|
configuration['print_debug_info'] = args.print_debug_info
|
||||||
configuration['all_members'] = args.all_members
|
configuration['all_members'] = args.all_members
|
||||||
|
configuration['no_array_expand'] = args.no_array_expand
|
||||||
|
|
||||||
if not args.elf_file:
|
if not args.elf_file:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user