about summary refs log tree commit diff stats
path: root/miasm2/jitter
diff options
context:
space:
mode:
Diffstat (limited to 'miasm2/jitter')
-rw-r--r--miasm2/jitter/jitload.py10
-rw-r--r--miasm2/jitter/loader/elf.py7
-rw-r--r--miasm2/jitter/loader/pe.py21
-rw-r--r--miasm2/jitter/loader/utils.py4
4 files changed, 21 insertions, 21 deletions
diff --git a/miasm2/jitter/jitload.py b/miasm2/jitter/jitload.py
index 7fe7e5ac..97fd3c80 100644
--- a/miasm2/jitter/jitload.py
+++ b/miasm2/jitter/jitload.py
@@ -55,19 +55,19 @@ def named_arguments(func):
             ret_ad, arg_vals = func(self, len(args))
             arg_vals = namedtuple("args", args)(*arg_vals)
             # func_name(arguments) return address
-            log_func.info('%s(%s) ret addr: %s' % (
+            log_func.info('%s(%s) ret addr: %s',
                 whoami(),
                 ', '.join("%s=0x%x" % (field, value)
                           for field, value in arg_vals._asdict().iteritems()),
-                hex(ret_ad)))
+                hex(ret_ad))
             return ret_ad, namedtuple("args", args)(*arg_vals)
         else:
             ret_ad, arg_vals = func(self, args)
             # func_name(arguments) return address
-            log_func.info('%s(%s) ret addr: %s' % (
+            log_func.info('%s(%s) ret addr: %s',
                 whoami(),
                 ', '.join(hex(arg) for arg in arg_vals),
-                hex(ret_ad)))
+                hex(ret_ad))
             return ret_ad, arg_vals
     return newfunc
 
@@ -404,7 +404,7 @@ class jitter:
         if fname in jitter.user_globals:
             func = jitter.user_globals[fname]
         else:
-            log.debug('%s' % repr(fname))
+            log.debug('%r', fname)
             raise ValueError('unknown api', hex(jitter.pc), repr(fname))
         func(jitter)
         jitter.pc = getattr(jitter.cpu, jitter.ir_arch.pc.name)
diff --git a/miasm2/jitter/loader/elf.py b/miasm2/jitter/loader/elf.py
index c0427e79..e5241910 100644
--- a/miasm2/jitter/loader/elf.py
+++ b/miasm2/jitter/loader/elf.py
@@ -40,8 +40,7 @@ def preload_elf(vm, e, runtime_lib, patch_vm_imp=True):
             libname_s = canon_libname_libfunc(libname, libfunc)
             dyn_funcs[libname_s] = ad_libfunc
             if patch_vm_imp:
-                log.debug('patch %s %s %s' %
-                          (hex(ad), hex(ad_libfunc), libfunc))
+                log.debug('patch 0x%x 0x%x %s', ad, ad_libfunc, libfunc)
                 vm.set_mem(
                     ad, struct.pack(cstruct.size2type[e.size], ad_libfunc))
     return runtime_lib, dyn_funcs
@@ -60,8 +59,8 @@ def vm_load_elf(vm, fdata, **kargs):
     for p in e.ph.phlist:
         if p.ph.type != 1:
             continue
-        log.debug('%s %s %s %s' %
-                  (hex(p.ph.vaddr), hex(p.ph.memsz), hex(p.ph.offset), hex(p.ph.filesz)))
+        log.debug('0x%x 0x%x 0x%x 0x%x', p.ph.vaddr, p.ph.memsz, p.ph.offset,
+                  p.ph.filesz)
         data_o = e._content[p.ph.offset:p.ph.offset + p.ph.filesz]
         addr_o = p.ph.vaddr
         a_addr = addr_o & ~0xFFF
diff --git a/miasm2/jitter/loader/pe.py b/miasm2/jitter/loader/pe.py
index 7c11b9c5..7bf8482b 100644
--- a/miasm2/jitter/loader/pe.py
+++ b/miasm2/jitter/loader/pe.py
@@ -170,8 +170,8 @@ def vm_load_pe(vm, fdata, align_s=True, load_hdr=True, **kargs):
 
     min_addr = pe.rva2virt(min_addr)
     max_addr = pe.rva2virt(max_addr)
-    log.debug('Min: 0x%x, Max: 0x%x, Size: 0x%x' % (min_addr, max_addr,
-                                                    (max_addr - min_addr)))
+    log.debug('Min: 0x%x, Max: 0x%x, Size: 0x%x', min_addr, max_addr,
+              (max_addr - min_addr))
 
     # Create only one big section containing the whole PE
     vm.add_memory_page(min_addr,
@@ -180,7 +180,8 @@ def vm_load_pe(vm, fdata, align_s=True, load_hdr=True, **kargs):
 
     # Copy each sections content in memory
     for section in pe.SHList:
-        log.debug('Map 0x%x bytes to 0x%x' % (len(section.data), pe.rva2virt(section.addr)))
+        log.debug('Map 0x%x bytes to 0x%x', len(section.data),
+                  pe.rva2virt(section.addr))
         vm.set_mem(pe.rva2virt(section.addr), str(section.data))
 
     return pe
@@ -245,7 +246,7 @@ def vm2pe(myjit, fname, libs=None, e_orig=None,
     for ad in addrs:
         if not min_addr <= ad < max_addr:
             continue
-        log.debug('%s' % hex(ad))
+        log.debug("0x%x", ad)
         if first:
             mye.SHList.add_section(
                 "%.8X" % ad,
@@ -270,18 +271,18 @@ def vm2pe(myjit, fname, libs=None, e_orig=None,
     else:
         new_dll = {}
 
-    log.debug('%s' % new_dll)
+    log.debug('%s', new_dll)
 
     mye.DirImport.add_dlldesc(new_dll)
     s_imp = mye.SHList.add_section("import", rawsize=len(mye.DirImport))
     mye.DirImport.set_rva(s_imp.addr)
-    log.debug('%s' % repr(mye.SHList))
+    log.debug('%r', mye.SHList)
     if e_orig:
         # resource
         xx = str(mye)
         mye.content = xx
         ad = e_orig.NThdr.optentries[pe.DIRECTORY_ENTRY_RESOURCE].rva
-        log.debug('dirres %s' % hex(ad))
+        log.debug('dirres 0x%x', ad)
         if ad != 0:
             mye.NThdr.optentries[pe.DIRECTORY_ENTRY_RESOURCE].rva = ad
             mye.DirRes = pe.DirRes.unpack(xx, ad, mye)
@@ -289,7 +290,7 @@ def vm2pe(myjit, fname, libs=None, e_orig=None,
             s_res = mye.SHList.add_section(
                 name="myres", rawsize=len(mye.DirRes))
             mye.DirRes.set_rva(s_res.addr)
-            log.debug('%s' % repr(mye.DirRes))
+            log.debug('%r', mye.DirRes)
     # generation
     open(fname, 'w').write(str(mye))
     return mye
@@ -303,7 +304,7 @@ class libimp_pe(libimp):
         if name in self.name2off:
             ad = self.name2off[name]
         else:
-            log.debug('new lib %s' % name)
+            log.debug('new lib %s', name)
             ad = e.NThdr.ImageBase
             libad = ad
             self.name2off[name] = ad
@@ -371,7 +372,7 @@ class libimp_pe(libimp):
 
             # Filter available addresses according to @flt
             all_ads = [addr for addr in out_ads.keys() if flt(addr)]
-            log.debug('ads: %s' % map(hex, all_ads))
+            log.debug('ads: %s', map(hex, all_ads))
             if not all_ads:
                 continue
 
diff --git a/miasm2/jitter/loader/utils.py b/miasm2/jitter/loader/utils.py
index 9305e713..a6a19cb3 100644
--- a/miasm2/jitter/loader/utils.py
+++ b/miasm2/jitter/loader/utils.py
@@ -32,13 +32,13 @@ class libimp:
         if not "." in name:
             log.debug('warning adding .dll to modulename')
             name += '.dll'
-            log.debug('%s' % name)
+            log.debug(name)
 
         if name in self.name2off:
             ad = self.name2off[name]
         else:
             ad = self.libbase_ad
-            log.debug('new lib %s %s' % (name, hex(ad)))
+            log.debug('new lib %s 0x%x', name, ad)
             self.name2off[name] = ad
             self.libbase2lastad[ad] = ad + 0x1
             self.lib_imp2ad[ad] = {}