Skip to content

Commit fc9898a

Browse files
authored
Merge pull request #1154 from elicn/improv
Misc improvements
2 parents 7c1580e + 38769e6 commit fc9898a

File tree

20 files changed

+636
-264
lines changed

20 files changed

+636
-264
lines changed

examples/windows_trace.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ def emulate(path, rootfs, verbose=QL_VERBOSE.DEBUG, enable_trace=False):
115115
parser.add_argument("-t", "--trace", help="Enable full trace", action='store_true', default=False)
116116
parser.add_argument("-R", "--root", help="rootfs", default=None)
117117
parser.add_argument("-d", "--dump", help="Directory to dump memory regions to", default="dump")
118-
#parser.add_argument("-a", "--automatize_input", help="Automatize writes on standard input", default=False)
119118
parser.add_argument("-p ", "--profile", help="customized profile",
120119
default="qiling/profiles/windows.ql")
121120
parser.add_argument('input', nargs='*')

qiling/arch/x86_utils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from qiling import Qiling
55
from qiling.arch.x86 import QlArchIntel
66
from qiling.arch.x86_const import *
7-
from qiling.exception import QlGDTError
7+
from qiling.exception import QlGDTError, QlMemoryMappedError
88
from qiling.os.memory import QlMemoryManager
99

1010
class GDTArray:
@@ -50,8 +50,10 @@ class GDTManager:
5050
def __init__(self, ql: Qiling, base = QL_X86_GDT_ADDR, limit = QL_X86_GDT_LIMIT, num_entries = 16):
5151
ql.log.debug(f'Mapping GDT at {base:#x} with limit {limit:#x}')
5252

53-
if not ql.mem.is_mapped(base, limit):
54-
ql.mem.map(base, limit, info="[GDT]")
53+
if not ql.mem.is_available(base, limit):
54+
raise QlMemoryMappedError('cannot map GDT, memory location is taken')
55+
56+
ql.mem.map(base, limit, info="[GDT]")
5557

5658
# setup GDT by writing to GDTR
5759
ql.arch.regs.write(UC_X86_REG_GDTR, (0, base, limit, 0x0))

qiling/core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(
4545
filter = None,
4646
stop: QL_STOP = QL_STOP.NONE,
4747
*,
48-
endian: QL_ENDIAN = None,
48+
endian: Optional[QL_ENDIAN] = None,
4949
thumb: bool = False,
5050
libcache: bool = False
5151
):
@@ -414,8 +414,8 @@ def debug_stop(self) -> bool:
414414
return self._debug_stop
415415

416416
@debug_stop.setter
417-
def debug_stop(self, ds):
418-
self._debug_stop = ds
417+
def debug_stop(self, enabled: bool):
418+
self._debug_stop = enabled
419419

420420
@property
421421
def debugger(self) -> bool:

0 commit comments

Comments
 (0)