aboutsummaryrefslogtreecommitdiffstats
path: root/test/Scripts
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-10-08 03:17:11 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-10-08 03:17:11 +0000
commit6ab219de7e8aa36aee266f111ac5e08ec8e4a16d (patch)
tree2c714f3b018e2b74258668281b89ed67d482cb1e /test/Scripts
parent290b316a4eb8616c388f1fa3bea7ef338bf6c4ec (diff)
downloadexternal_llvm-6ab219de7e8aa36aee266f111ac5e08ec8e4a16d.zip
external_llvm-6ab219de7e8aa36aee266f111ac5e08ec8e4a16d.tar.gz
external_llvm-6ab219de7e8aa36aee266f111ac5e08ec8e4a16d.tar.bz2
MC-COFF: Fix Simple and Complex type. Fixes PR8320.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116037 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Scripts')
-rwxr-xr-xtest/Scripts/coff-dump.py35
1 files changed, 24 insertions, 11 deletions
diff --git a/test/Scripts/coff-dump.py b/test/Scripts/coff-dump.py
index 055fec5..a75cf6b 100755
--- a/test/Scripts/coff-dump.py
+++ b/test/Scripts/coff-dump.py
@@ -167,7 +167,8 @@ file = ('struct', [
('Name', ('scalar', '<8s', symname)),
('Value', ('scalar', '<L', '%d' )),
('SectionNumber', ('scalar', '<H', '%d' )),
- ('SimpleType', ('enum', '<B', '%d', {
+ ('_Type', ('scalar', '<H', None )),
+ ('SimpleType', ('enum', '& _Type 15', '%d', {
0: 'IMAGE_SYM_TYPE_NULL',
1: 'IMAGE_SYM_TYPE_VOID',
2: 'IMAGE_SYM_TYPE_CHAR',
@@ -184,8 +185,8 @@ file = ('struct', [
13: 'IMAGE_SYM_TYPE_WORD',
14: 'IMAGE_SYM_TYPE_UINT',
15: 'IMAGE_SYM_TYPE_DWORD',
- })),
- ('ComplexType', ('enum', '<B', '%d', {
+ })), # (Type & 0xF0) >> 4
+ ('ComplexType', ('enum', '>> & _Type 240 4', '%d', {
0: 'IMAGE_SYM_DTYPE_NULL',
1: 'IMAGE_SYM_DTYPE_POINTER',
2: 'IMAGE_SYM_DTYPE_FUNCTION',
@@ -317,7 +318,7 @@ def print_binary_data(size):
write("%s|%s|\n" % (bytes, text))
return value
-idlit = re.compile("[a-zA-Z][a-zA-Z0-9_-]*")
+idlit = re.compile("[a-zA-Z_][a-zA-Z0-9_-]*")
numlit = re.compile("[0-9]+")
def read_value(expr):
@@ -335,11 +336,6 @@ def read_value(expr):
if expr == 'false':
return False
- if len(token) > 1 and token[0] in ('=', '@', '<', '!', '>'):
- val = read(expr)
- assert(len(val) == 1)
- return val[0]
-
if token == '+':
return eval() + eval()
if token == '-':
@@ -348,6 +344,19 @@ def read_value(expr):
return eval() * eval()
if token == '/':
return eval() / eval()
+ if token == '&':
+ return eval() & eval()
+ if token == '|':
+ return eval() | eval()
+ if token == '>>':
+ return eval() >> eval()
+ if token == '<<':
+ return eval() << eval()
+
+ if len(token) > 1 and token[0] in ('=', '@', '<', '!', '>'):
+ val = read(expr)
+ assert(len(val) == 1)
+ return val[0]
if idlit.match(token):
return Fields[token]
@@ -373,6 +382,8 @@ def write_value(format,value):
elif format_type is types.TupleType:
Fields['this'] = value
handle_element(format)
+ elif format_type is types.NoneType:
+ pass
else:
raise RuntimeError("unexpected type: %s" % repr(format_type))
@@ -448,11 +459,13 @@ def handle_struct(entry):
name = member[0]
type = member[1]
- write("%s = "%name.ljust(24))
+ if name[0] != "_":
+ write("%s = " % name.ljust(24))
value = handle_element(type)
- write("\n")
+ if name[0] != "_":
+ write("\n")
Fields[name] = value
newFields[name] = value