Skip to content

Commit

Permalink
Merge pull request #5 from TinyPART/FixWarningsFromEscapes
Browse files Browse the repository at this point in the history
Fix warnings from invalid escapes
  • Loading branch information
chrysn authored Dec 6, 2024
2 parents b95e058 + c896499 commit a19b2a2
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions cosy.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,28 +195,28 @@ def parse_mapfile(mapfile):
with open(mapfile, 'r') as f:
for line in f:

if re.match("^\.text", line):
if re.match(r"^\.text", line):
cur_type = 't'
continue

if re.match("^\.(bss|stack)", line):
if re.match(r"^\.(bss|stack)", line):
cur_type = 'b'
continue

if re.match("^\.(relocate|data)", line):
if re.match(r"^\.(relocate|data)", line):
cur_type = 'd'
continue

# if re.match("^\..+", line):
if re.match("^OUTPUT.+", line):
# if re.match(r"^\..+", line):
if re.match(r"^OUTPUT.+", line):
add_sym(res, cur_sym)
cur_type = ''
# continue
break

if cur_type:
# fill bytes?
m = re.match("^ *\*fill\* +0x([0-9a-f]+) +0x([0-9a-f])+", line)
m = re.match(r"^ *\*fill\* +0x([0-9a-f]+) +0x([0-9a-f])+", line)
if m:
add_sym(res, cur_sym)
cur_sym = {
Expand All @@ -234,7 +234,7 @@ def parse_mapfile(mapfile):
continue

# start of a new symbol
m = re.match(" \.([a-z]+\.)?([-_\.A-Za-z0-9$.]+)", line)
m = re.match(r" \.([a-z]+\.)?([-_\.A-Za-z0-9$.]+)", line)
if m:
# save last symbol
add_sym(res, cur_sym)
Expand All @@ -253,22 +253,22 @@ def parse_mapfile(mapfile):
}

# get size, addr and path of current symbol
m = re.match(".+0x([0-9a-f]+) +0x([0-9a-f]+) (/.+)$", line)
m = re.match(r".+0x([0-9a-f]+) +0x([0-9a-f]+) (/.+)$", line)
if m:
cur_sym['addr'] = int(m.group(1), 16)
cur_sym['size'] = int(m.group(2), 16)
# get object and archive files
me = re.match(".+/([-_a-zA-Z0-9]+\.a)\(([-_a-zA-Z0-9]+\.o)\)$", m.group(3))
me = re.match(r".+/([-_a-zA-Z0-9]+\.a)\(([-_a-zA-Z0-9]+\.o)\)$", m.group(3))
if me:
cur_sym['arcv'] = me.group(1)
cur_sym['obj'] = me.group(2)
me = re.match(".+/([-_a-zA-Z0-9]+\.o)$", m.group(3))
me = re.match(r".+/([-_a-zA-Z0-9]+\.o)$", m.group(3))
if me:
cur_sym['arcv'] = ''
cur_sym['obj'] = me.group(1)
continue

m = re.match(" +0x[0-9a-f]+ +([-_a-zA-Z0-9]+)$", line)
m = re.match(r" +0x[0-9a-f]+ +([-_a-zA-Z0-9]+)$", line)
if m:
cur_sym['alias'].append(m.group(1))
return res
Expand Down

0 comments on commit a19b2a2

Please sign in to comment.