forked from qt-creator/qt-creator
Debugger: Show shadowed variables with LLDB
Change-Id: If93547396384fe5b421c4b601b52476a23cdfa89 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -53,17 +53,17 @@ proc = subprocess.Popen(args=[sys.argv[1], '-P'], stdout=subprocess.PIPE, stderr
|
||||
(path, error) = proc.communicate()
|
||||
|
||||
if error.startswith('lldb: invalid option -- P'):
|
||||
sys.stdout.write('msg=\'Could not run "%s -P". Trying to find lldb.so from Xcode.\'@\n' % sys.argv[1])
|
||||
sys.stdout.write('msg=\'Could not run "%s -P". Trying to find lldb.so from Xcode.\'\n' % sys.argv[1])
|
||||
proc = subprocess.Popen(args=['xcode-select', '--print-path'],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
(path, error) = proc.communicate()
|
||||
if len(error):
|
||||
path = '/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/Python/'
|
||||
sys.stdout.write('msg=\'Could not run "xcode-select --print-path"@\n')
|
||||
sys.stdout.write('msg=\'Using hardcoded fallback at %s\'@\n' % path)
|
||||
sys.stdout.write('msg=\'Could not run "xcode-select --print-path"\n')
|
||||
sys.stdout.write('msg=\'Using hardcoded fallback at %s\'\n' % path)
|
||||
else:
|
||||
path = path.strip() + '/../SharedFrameworks/LLDB.framework/Versions/A/Resources/Python/'
|
||||
sys.stdout.write('msg=\'Using fallback at %s\'@\n' % path)
|
||||
sys.stdout.write('msg=\'Using fallback at %s\'\n' % path)
|
||||
|
||||
#sys.path.append(path)
|
||||
sys.path.insert(1, path.strip())
|
||||
@@ -142,7 +142,7 @@ stateNames = ["invalid", "unloaded", "connected", "attaching", "launching", "sto
|
||||
def loggingCallback(args):
|
||||
s = args.strip()
|
||||
s = s.replace('"', "'")
|
||||
sys.stdout.write('log="%s"@\n' % s)
|
||||
sys.stdout.write('log="%s"\n' % s)
|
||||
|
||||
def check(exp):
|
||||
if not exp:
|
||||
@@ -1223,13 +1223,22 @@ class Dumper(DumperBase):
|
||||
self.currentIName = 'local'
|
||||
self.put('data=[')
|
||||
self.anonNumber = 0
|
||||
for value in frame.GetVariables(True, True, False, False):
|
||||
shadowed = {}
|
||||
values = [v for v in frame.GetVariables(True, True, False, False) if v.IsValid()]
|
||||
values.reverse() # To get shadowed vars numbered backwards.
|
||||
for value in values:
|
||||
if self.dummyValue is None:
|
||||
self.dummyValue = value
|
||||
with SubItem(self, value):
|
||||
if value.IsValid():
|
||||
self.put('iname="%s",' % self.currentIName)
|
||||
self.putItem(value)
|
||||
name = value.name
|
||||
if value.name in shadowed:
|
||||
level = shadowed[name]
|
||||
shadowed[name] = level + 1
|
||||
name += "@%s" % level
|
||||
else:
|
||||
shadowed[name] = 1
|
||||
with SubItem(self, name):
|
||||
self.put('iname="%s",' % self.currentIName)
|
||||
self.putItem(value)
|
||||
|
||||
# 'watchers':[{'id':'watch.0','exp':'23'},...]
|
||||
if not self.dummyValue is None:
|
||||
@@ -1283,8 +1292,7 @@ class Dumper(DumperBase):
|
||||
self.report(result)
|
||||
|
||||
def report(self, stuff):
|
||||
sys.stdout.write(stuff)
|
||||
sys.stdout.write("@\n")
|
||||
sys.stdout.write(stuff + "\n")
|
||||
|
||||
def interruptInferior(self, _ = None):
|
||||
if self.process is None:
|
||||
|
||||
@@ -836,15 +836,14 @@ void LldbEngine::readLldbStandardError()
|
||||
void LldbEngine::readLldbStandardOutput()
|
||||
{
|
||||
QByteArray out = m_lldbProc.readAllStandardOutput();
|
||||
//showMessage(_("Lldb stdout: " + out));
|
||||
showMessage(_(out), LogDebug);
|
||||
showMessage(_("Lldb stdout: " + out));
|
||||
m_inbuffer.append(out);
|
||||
while (true) {
|
||||
int pos = m_inbuffer.indexOf("@\n");
|
||||
int pos = m_inbuffer.indexOf('\n');
|
||||
if (pos == -1)
|
||||
break;
|
||||
QByteArray response = m_inbuffer.left(pos).trimmed();
|
||||
m_inbuffer = m_inbuffer.mid(pos + 2);
|
||||
m_inbuffer = m_inbuffer.mid(pos + 1);
|
||||
emit outputReady(response);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user