summaryrefslogtreecommitdiffstats
path: root/userspace-header-gen.py
diff options
context:
space:
mode:
authorChristian Mauderer <Christian.Mauderer@embedded-brains.de>2017-01-17 12:00:55 +0100
committerChristian Mauderer <Christian.Mauderer@embedded-brains.de>2017-01-17 12:51:30 +0100
commit46d0378cc6444efab01c7d1696de5eb1889a0506 (patch)
tree11ad98c5dc06ebffc5c36f6ce538d9ff210749a6 /userspace-header-gen.py
parent120caa668f8a2f1d78dd04ddf4f9120302f3ad91 (diff)
downloadrtems-libbsd-46d0378cc6444efab01c7d1696de5eb1889a0506.tar.bz2
userspace-header-gen: Don't generate first array size.
Diffstat (limited to 'userspace-header-gen.py')
-rwxr-xr-xuserspace-header-gen.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/userspace-header-gen.py b/userspace-header-gen.py
index d062275a..0d4dbdae 100755
--- a/userspace-header-gen.py
+++ b/userspace-header-gen.py
@@ -111,7 +111,7 @@ class HeaderGenCU:
def _die_is_function(self, die):
return (die.tag == "DW_TAG_subprogram")
- def _get_type(self, die):
+ def _get_type(self, die, first_array = True):
"""Get the type of a variable DIE.
Returns two strings: one prefix and one postfix for the variable name"""
typepre = ""
@@ -139,11 +139,15 @@ class HeaderGenCU:
elif (typedie.tag == "DW_TAG_array_type"):
for child in typedie.iter_children():
if child.tag == "DW_TAG_subrange_type":
- try:
- upper_bound = child.attributes["DW_AT_upper_bound"].value
- arraysize = "%d" % (upper_bound + 1)
- except KeyError:
+ if first_array == True:
arraysize = ""
+ first_array = False
+ else:
+ try:
+ upper_bound = child.attributes["DW_AT_upper_bound"].value
+ arraysize = "%d" % (upper_bound + 1)
+ except KeyError:
+ arraysize = ""
typepost += "[%s]" % arraysize
elif (typedie.tag == "DW_TAG_volatile_type"):
@@ -200,7 +204,7 @@ class HeaderGenCU:
raise TypenameNotFoundError(message)
if last == False:
- addpre, addpost = self._get_type(typedie)
+ addpre, addpost = self._get_type(typedie, first_array)
typepre = addpre + typepre
typepost = typepost + addpost