Debugger: Allow explicit padding in patterns

Change-Id: I6f2302649cdbcbb9052a6898841c21301dace9e6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2016-10-04 11:33:32 +02:00
parent 10ca871681
commit 21ba1f7b7a
+14 -2
View File
@@ -3341,8 +3341,20 @@ class DumperBase:
elif c == '{':
readingTypeName = True
typeName = ""
elif c == '@': # Automatic padding.
builder.autoPadNext = True
elif c == '@':
if n is None:
# Automatic padding depending on next item
builder.autoPadNext = True
else:
# Explicit padding.
builder.currentBitsize = 8 * ((builder.currentBitsize + 7) >> 3)
padding = (int(n) - (builder.currentBitsize >> 3)) % int(n)
field = self.Field(self)
field.code = None
builder.pattern += "%ds" % padding
builder.currentBitsize += padding * 8
builder.fields.append(field)
n = None
else:
error("UNKNOWN STRUCT CODE: %s" % c)
pp = builder.pattern