diff options
| author | serpilliere <devnull@localhost> | 2012-12-03 10:55:34 +0100 |
|---|---|---|
| committer | serpilliere <devnull@localhost> | 2012-12-03 10:55:34 +0100 |
| commit | db218bfa167662eec12c2016472399e858d621ba (patch) | |
| tree | e36e9d400410e473bddcddb3eb6f55db45ae4881 /miasm/core/parse_asm.py | |
| parent | f9a6599e88502ae3c7555df6af411a446ddf2900 (diff) | |
| download | focaccia-miasm-db218bfa167662eec12c2016472399e858d621ba.tar.gz focaccia-miasm-db218bfa167662eec12c2016472399e858d621ba.zip | |
core: fix add_label api for asm_bloc (louis granboulan)
Diffstat (limited to 'miasm/core/parse_asm.py')
| -rw-r--r-- | miasm/core/parse_asm.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/miasm/core/parse_asm.py b/miasm/core/parse_asm.py index 430df537..7a1dc242 100644 --- a/miasm/core/parse_asm.py +++ b/miasm/core/parse_asm.py @@ -23,10 +23,10 @@ declarator = {'byte':'B', 'long':'I'} def guess_next_new_label(symbol_pool, gen_label_index = 0): i = 0 while True: - l = asm_label(i) + l = symbol_pool.getby_name(i) + if l == None: + return symbol_pool.add_label(i) i+=1 - if not l.name in symbol_pool.s: - return l def parse_txt(mnemo, txt, symbol_pool = None, gen_label_index = 0): @@ -154,7 +154,6 @@ def parse_txt(mnemo, txt, symbol_pool = None, gen_label_index = 0): if state == 0: if not isinstance(lines[i], asm_label): l = guess_next_new_label(symbol_pool) - symbol_pool.add(l) lines[i:i] = [l] else: l = lines[i] @@ -208,7 +207,6 @@ def parse_txt(mnemo, txt, symbol_pool = None, gen_label_index = 0): l = lines[i+1] else: l = guess_next_new_label(symbol_pool) - symbol_pool.add(l) lines[i+1:i+1] = [l] else: state = 0 |