tools: Do not use os.EX_DATAERR due to unavailability on windows
Just return a plain exit code...
This commit is contained in:
parent
0e7f2b33cf
commit
e68ded37fe
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import argparse
|
import argparse
|
||||||
import os, sys
|
import sys
|
||||||
|
|
||||||
from lib.dump import decode_dump
|
from lib.dump import decode_dump
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ def main():
|
|||||||
# decode the dump data
|
# decode the dump data
|
||||||
dump = decode_dump(args.dump)
|
dump = decode_dump(args.dump)
|
||||||
if dump is None:
|
if dump is None:
|
||||||
return os.EX_DATAERR
|
return 1
|
||||||
|
|
||||||
# output descriptors
|
# output descriptors
|
||||||
if args.info:
|
if args.info:
|
||||||
|
@ -4,7 +4,6 @@ import elftools.elf.elffile
|
|||||||
import elftools.dwarf.descriptions
|
import elftools.dwarf.descriptions
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from struct import unpack
|
from struct import unpack
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from lib.dump import decode_dump
|
from lib.dump import decode_dump
|
||||||
@ -374,7 +373,7 @@ def main():
|
|||||||
# fetch the memory data
|
# fetch the memory data
|
||||||
dump = decode_dump(args.dump)
|
dump = decode_dump(args.dump)
|
||||||
if dump is None:
|
if dump is None:
|
||||||
return os.EX_DATAERR
|
return 1
|
||||||
|
|
||||||
# strip padding, if present
|
# strip padding, if present
|
||||||
addr_start = dump.ranges[0][0]
|
addr_start = dump.ranges[0][0]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import argparse
|
import argparse
|
||||||
import struct
|
import struct
|
||||||
import os, sys
|
import sys
|
||||||
|
|
||||||
from lib.dump import DUMP_MAGIC, DUMP_OFFSET, DUMP_SIZE
|
from lib.dump import DUMP_MAGIC, DUMP_OFFSET, DUMP_SIZE
|
||||||
|
|
||||||
@ -25,13 +25,13 @@ def main():
|
|||||||
data = fd.read(DUMP_SIZE)
|
data = fd.read(DUMP_SIZE)
|
||||||
if len(data) != DUMP_SIZE:
|
if len(data) != DUMP_SIZE:
|
||||||
error('incorrect image size')
|
error('incorrect image size')
|
||||||
return os.EX_DATAERR
|
return 1
|
||||||
|
|
||||||
# check for magic header
|
# check for magic header
|
||||||
magic, = struct.unpack('<L', data[:4])
|
magic, = struct.unpack('<L', data[:4])
|
||||||
if magic != DUMP_MAGIC:
|
if magic != DUMP_MAGIC:
|
||||||
error('invalid dump magic or no dump')
|
error('invalid dump magic or no dump')
|
||||||
return os.EX_DATAERR
|
return 1
|
||||||
|
|
||||||
# output D21 dump
|
# output D21 dump
|
||||||
print('D21 - read crash dump', end='')
|
print('D21 - read crash dump', end='')
|
||||||
|
Loading…
Reference in New Issue
Block a user