Commit 31558505 authored by hjk's avatar hjk
Browse files

Debugger: Properly retrieve signed internal values with LLDB



Fixes the QLinkedList dumper.

Change-Id: I1be509c16ed96edb02c540d9c87b9506e496ed2c
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent 53e2f9b4
......@@ -726,9 +726,15 @@ class Dumper(DumperBase):
def extractInt64(self, addr):
return struct.unpack("q", self.readRawMemory(addr, 8))[0]
def extractUInt64(self, addr):
return struct.unpack("Q", self.readRawMemory(addr, 8))[0]
def extractInt(self, addr):
return struct.unpack("i", self.readRawMemory(addr, 4))[0]
def extractUInt(self, addr):
return struct.unpack("I", self.readRawMemory(addr, 4))[0]
def extractByte(self, addr):
return struct.unpack("b", self.readRawMemory(addr, 1))[0]
......
......@@ -508,14 +508,26 @@ class Dumper(DumperBase):
def addressOf(self, value):
return int(value.GetLoadAddress())
def extractInt(self, address):
def extractUInt(self, address):
error = lldb.SBError()
return int(self.process.ReadUnsignedFromMemory(address, 4, error))
def extractInt64(self, address):
def extractInt(self, address):
i = self.extractUInt(address)
if i >= 0x80000000:
i -= 0x100000000
return i
def extractUInt64(self, address):
error = lldb.SBError()
return int(self.process.ReadUnsignedFromMemory(address, 8, error))
def extractInt64(self, address):
i = self.extractUInt64(address)
if i >= 0x8000000000000000:
i -= 0x10000000000000000
return i
def extractByte(self, address):
error = lldb.SBError()
return int(self.process.ReadUnsignedFromMemory(address, 1, error) & 0xFF)
......
......@@ -385,8 +385,8 @@ def qdump__std__set__QNX(d, value):
def qdump__std____1__set(d, value):
base3 = d.addressOf(value["__tree_"]["__pair3_"])
size = d.extractInt(base3)
d.check(0 <= size and size <= 100*1000*1000)
size = d.extractUInt(base3)
d.check(size <= 100*1000*1000)
d.putItemCount(size)
d.putNumChild(0)
......@@ -442,7 +442,7 @@ def qdump__std____1__string(d, value):
if firstByte & 1:
# Long/external.
data = d.extractPointer(base + 2 * d.ptrSize())
size = d.extractInt(base + d.ptrSize())
size = d.extractUInt(base + d.ptrSize())
else:
# Short/internal.
size = firstByte / 2
......@@ -457,7 +457,7 @@ def qdump__std____1__wstring(d, value):
if firstByte & 1:
# Long/external.
data = d.extractPointer(base + 2 * d.ptrSize())
size = d.extractInt(base + d.ptrSize())
size = d.extractUInt(base + d.ptrSize())
else:
# Short/internal.
size = firstByte / 2
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment