diff options
| author | Ajax <commial@gmail.com> | 2018-07-02 19:12:53 +0200 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2018-07-03 14:28:18 +0200 |
| commit | d314460a5a19be1f3334baedf0105d9b72fc8620 (patch) | |
| tree | 967c5856dcf37980cf80a2ea48cc7ee0e008e1bd /miasm2/jitter/codegen.py | |
| parent | 68fac2e86cc61eba9adfe520fa0e04a7e8943450 (diff) | |
| download | miasm-d314460a5a19be1f3334baedf0105d9b72fc8620.tar.gz miasm-d314460a5a19be1f3334baedf0105d9b72fc8620.zip | |
Update symbol_pool's deprecated API -> LocationDB
Diffstat (limited to 'miasm2/jitter/codegen.py')
| -rw-r--r-- | miasm2/jitter/codegen.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/miasm2/jitter/codegen.py b/miasm2/jitter/codegen.py index cf8f1711..10140fd2 100644 --- a/miasm2/jitter/codegen.py +++ b/miasm2/jitter/codegen.py @@ -143,7 +143,7 @@ class CGen(object): new_assignblk = dict(assignblk) if self.ir_arch.IRDst not in assignblk: offset = instr.offset + instr.l - loc_key = self.ir_arch.loc_db.getby_offset_create(offset) + loc_key = self.ir_arch.loc_db.get_or_create_offset_location(offset) dst = ExprLoc(loc_key, self.ir_arch.IRDst.size) new_assignblk[self.ir_arch.IRDst] = dst irs = [AssignBlock(new_assignblk, instr)] @@ -290,12 +290,12 @@ class CGen(object): "((%s)?(%s):(%s))" % (cond, src1b, src2b)) if isinstance(expr, ExprInt): offset = int(expr) - loc_key = self.ir_arch.loc_db.getby_offset_create(offset) + loc_key = self.ir_arch.loc_db.get_or_create_offset_location(offset) self.add_label_index(dst2index, loc_key) return ("%s" % dst2index[loc_key], hex(offset)) if expr.is_loc(): loc_key = expr.loc_key - offset = self.ir_arch.loc_db.loc_key_to_offset(expr.loc_key) + offset = self.ir_arch.loc_db.get_location_offset(expr.loc_key) if offset is not None: self.add_label_index(dst2index, loc_key) return ("%s" % dst2index[loc_key], hex(offset)) @@ -367,7 +367,7 @@ class CGen(object): return out assert isinstance(dst, LocKey) - offset = self.ir_arch.loc_db.loc_key_to_offset(dst) + offset = self.ir_arch.loc_db.get_location_offset(dst) if offset is None: # Generate goto for local labels return ['goto %s;' % dst] @@ -518,7 +518,7 @@ class CGen(object): last_instr = block.lines[-1] offset = last_instr.offset + last_instr.l - return self.ir_arch.loc_db.getby_offset_create(offset) + return self.ir_arch.loc_db.get_or_create_offset_location(offset) def gen_init(self, block): """ @@ -528,7 +528,7 @@ class CGen(object): instr_offsets = [line.offset for line in block.lines] post_label = self.get_block_post_label(block) - post_offset = self.ir_arch.loc_db.loc_key_to_offset(post_label) + post_offset = self.ir_arch.loc_db.get_location_offset(post_label) instr_offsets.append(post_offset) lbl_start = block.loc_key return (self.CODE_INIT % lbl_start).split("\n"), instr_offsets @@ -564,7 +564,7 @@ class CGen(object): """ loc_key = self.get_block_post_label(block) - offset = self.ir_arch.loc_db.loc_key_to_offset(loc_key) + offset = self.ir_arch.loc_db.get_location_offset(loc_key) dst = self.dst_to_c(offset) code = self.CODE_RETURN_NO_EXCEPTION % (loc_key, self.C_PC, dst, dst) return code.split('\n') |