Commit 7066e334 authored by hjk's avatar hjk

Debugger: Improve tooltip for out-of-scope items with gdb

Previously, hovering over 'i' when stopped in main()

   int foo() { int i; }
   int main() {}

produced a tooltip without contents, now there is an
item saying "<not accessible>"

Change-Id: Id4de72541f74af93ba65c2a9508cf21e1dcd6569
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent bc65b6b1
......@@ -58,7 +58,7 @@ def registerCommand(name, func):
Command()
def listOfLocals(varList):
def listOfLocals():
frame = gdb.selected_frame()
try:
......@@ -444,30 +444,30 @@ class Dumper(DumperBase):
# Locals
#
self.output.append('data=[')
locals = []
fullUpdateNeeded = True
if self.partialUpdate and len(self.varList) == 1 and not self.tooltipOnly:
if self.partialUpdate and len(self.varList) == 1:
#warn("PARTIAL: %s" % self.varList)
parts = self.varList[0].split('.')
#warn("PARTIAL PARTS: %s" % parts)
name = parts[1]
#warn("PARTIAL VAR: %s" % name)
#fullUpdateNeeded = False
item = LocalItem()
item.iname = parts[0] + '.' + name
item.name = name
try:
frame = gdb.selected_frame()
item = LocalItem()
item.iname = "local." + name
item.name = name
item.value = frame.read_var(name)
locals = [item]
#warn("PARTIAL LOCALS: %s" % locals)
fullUpdateNeeded = False
if parts[0] == 'local':
frame = gdb.selected_frame()
item.value = frame.read_var(name)
else:
item.name = self.hexdecode(name)
item.value = gdb.parse_and_eval(item.name)
except RuntimeError as error:
item.value = error
except:
pass
self.varList = []
if fullUpdateNeeded and not self.tooltipOnly:
locals = listOfLocals(self.varList)
item.value = "<no value>"
locals = [item]
#warn("PARTIAL LOCALS: %s" % locals)
else:
locals = listOfLocals()
# Take care of the return value of the last function call.
if len(self.resultVarName) > 0:
......
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