2010-06-09 00:52:24 +08:00
|
|
|
//===-- SBFrame.cpp ---------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2010-06-09 00:52:24 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include <algorithm>
|
2016-04-30 05:00:38 +08:00
|
|
|
#include <set>
|
2015-10-31 09:22:59 +08:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "lldb/API/SBFrame.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
#include "lldb/lldb-types.h"
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
#include "SBReproducerPrivate.h"
|
2019-03-06 08:05:55 +08:00
|
|
|
#include "Utils.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Core/Address.h"
|
|
|
|
#include "lldb/Core/StreamFile.h"
|
|
|
|
#include "lldb/Core/ValueObjectRegister.h"
|
|
|
|
#include "lldb/Core/ValueObjectVariable.h"
|
2019-06-14 07:40:34 +08:00
|
|
|
#include "lldb/Expression/ExpressionVariable.h"
|
2015-09-16 05:13:50 +08:00
|
|
|
#include "lldb/Expression/UserExpression.h"
|
2011-06-25 12:35:01 +08:00
|
|
|
#include "lldb/Host/Host.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Symbol/Block.h"
|
<rdar://problem/11757916>
Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes:
- Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file".
- modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly
- Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was.
- modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile()
Cleaned up header includes a bit as well.
llvm-svn: 162860
2012-08-30 05:13:06 +08:00
|
|
|
#include "lldb/Symbol/Function.h"
|
|
|
|
#include "lldb/Symbol/Symbol.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Symbol/SymbolContext.h"
|
|
|
|
#include "lldb/Symbol/Variable.h"
|
|
|
|
#include "lldb/Symbol/VariableList.h"
|
|
|
|
#include "lldb/Target/ExecutionContext.h"
|
|
|
|
#include "lldb/Target/Process.h"
|
|
|
|
#include "lldb/Target/RegisterContext.h"
|
2013-11-04 17:33:30 +08:00
|
|
|
#include "lldb/Target/StackFrame.h"
|
2018-10-31 12:00:22 +08:00
|
|
|
#include "lldb/Target/StackFrameRecognizer.h"
|
2012-01-30 15:41:31 +08:00
|
|
|
#include "lldb/Target/StackID.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Target/Target.h"
|
|
|
|
#include "lldb/Target/Thread.h"
|
2017-02-03 05:39:50 +08:00
|
|
|
#include "lldb/Utility/ConstString.h"
|
|
|
|
#include "lldb/Utility/Stream.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2010-06-09 15:44:37 +08:00
|
|
|
#include "lldb/API/SBAddress.h"
|
|
|
|
#include "lldb/API/SBDebugger.h"
|
2012-10-17 05:41:58 +08:00
|
|
|
#include "lldb/API/SBExpressionOptions.h"
|
2010-09-20 13:20:02 +08:00
|
|
|
#include "lldb/API/SBStream.h"
|
2010-06-09 15:44:37 +08:00
|
|
|
#include "lldb/API/SBSymbolContext.h"
|
|
|
|
#include "lldb/API/SBThread.h"
|
|
|
|
#include "lldb/API/SBValue.h"
|
2015-02-18 01:55:50 +08:00
|
|
|
#include "lldb/API/SBVariablesOptions.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-12-15 05:31:31 +08:00
|
|
|
#include "llvm/Support/PrettyStackTrace.h"
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
SBFrame::SBFrame() : m_opaque_sp(new ExecutionContextRef()) {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBFrame);
|
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2013-11-04 17:33:30 +08:00
|
|
|
SBFrame::SBFrame(const StackFrameSP &lldb_object_sp)
|
2012-04-06 00:12:35 +08:00
|
|
|
: m_opaque_sp(new ExecutionContextRef(lldb_object_sp)) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBFrame, (const lldb::StackFrameSP &),
|
|
|
|
lldb_object_sp);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2019-03-06 08:05:55 +08:00
|
|
|
SBFrame::SBFrame(const SBFrame &rhs) : m_opaque_sp() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBFrame, (const lldb::SBFrame &), rhs);
|
|
|
|
|
2019-03-06 08:05:55 +08:00
|
|
|
m_opaque_sp = clone(rhs.m_opaque_sp);
|
|
|
|
}
|
2010-11-06 07:17:00 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
SBFrame::~SBFrame() = default;
|
|
|
|
|
2010-11-06 07:17:00 +08:00
|
|
|
const SBFrame &SBFrame::operator=(const SBFrame &rhs) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(const lldb::SBFrame &,
|
|
|
|
SBFrame, operator=,(const lldb::SBFrame &), rhs);
|
|
|
|
|
2010-11-06 07:17:00 +08:00
|
|
|
if (this != &rhs)
|
2019-03-06 08:05:55 +08:00
|
|
|
m_opaque_sp = clone(rhs.m_opaque_sp);
|
2019-04-04 05:31:22 +08:00
|
|
|
return LLDB_RECORD_RESULT(*this);
|
2010-11-06 07:17:00 +08:00
|
|
|
}
|
|
|
|
|
2012-01-30 15:41:31 +08:00
|
|
|
StackFrameSP SBFrame::GetFrameSP() const {
|
2015-10-31 09:22:59 +08:00
|
|
|
return (m_opaque_sp ? m_opaque_sp->GetFrameSP() : StackFrameSP());
|
2012-01-30 15:41:31 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2013-11-04 17:33:30 +08:00
|
|
|
void SBFrame::SetFrameSP(const StackFrameSP &lldb_object_sp) {
|
2012-04-06 00:12:35 +08:00
|
|
|
return m_opaque_sp->SetFrameSP(lldb_object_sp);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBFrame::IsValid() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBFrame, IsValid);
|
Add "operator bool" to SB APIs
Summary:
Our python version of the SB API has (the python equivalent of)
operator bool, but the C++ version doesn't.
This is because our python operators are added by modify-python-lldb.py,
which performs postprocessing on the swig-generated interface files.
In this patch, I add the "operator bool" to all SB classes which have an
IsValid method (which is the same logic used by modify-python-lldb.py).
This way, we make the two interfaces more constent, and it allows us to
rely on swig's automatic syntesis of python __nonzero__ methods instead
of doing manual fixups.
Reviewers: zturner, jingham, clayborg, jfb, serge-sans-paille
Subscribers: jdoerfert, lldb-commits
Differential Revision: https://reviews.llvm.org/D58792
llvm-svn: 355824
2019-03-11 21:58:46 +08:00
|
|
|
return this->operator bool();
|
|
|
|
}
|
|
|
|
SBFrame::operator bool() const {
|
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBFrame, operator bool);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-05-07 08:54:56 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
|
|
|
Process::StopLocker stop_locker;
|
|
|
|
if (stop_locker.TryLock(&process->GetRunLock()))
|
|
|
|
return GetFrameSP().get() != nullptr;
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-05-07 08:54:56 +08:00
|
|
|
// Without a target & process we can't have a valid stack frame.
|
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBSymbolContext SBFrame::GetSymbolContext(uint32_t resolve_scope) const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST(lldb::SBSymbolContext, SBFrame, GetSymbolContext,
|
|
|
|
(uint32_t), resolve_scope);
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBSymbolContext sb_sym_ctx;
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2018-10-26 04:45:19 +08:00
|
|
|
SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope);
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
2019-03-08 06:47:13 +08:00
|
|
|
if (frame)
|
2018-10-26 04:45:19 +08:00
|
|
|
sb_sym_ctx.SetSymbolContext(&frame->GetSymbolContext(scope));
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-10-26 11:11:13 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_sym_ctx);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBModule SBFrame::GetModule() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBModule, SBFrame, GetModule);
|
|
|
|
|
2010-12-14 12:58:53 +08:00
|
|
|
SBModule sb_module;
|
2012-01-30 17:04:36 +08:00
|
|
|
ModuleSP module_sp;
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
|
|
|
module_sp = frame->GetSymbolContext(eSymbolContextModule).module_sp;
|
|
|
|
sb_module.SetSP(module_sp);
|
2012-04-06 00:12:35 +08:00
|
|
|
}
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-12-14 12:58:53 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_module);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBCompileUnit SBFrame::GetCompileUnit() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBCompileUnit, SBFrame,
|
|
|
|
GetCompileUnit);
|
|
|
|
|
2010-12-14 12:58:53 +08:00
|
|
|
SBCompileUnit sb_comp_unit;
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
|
|
|
sb_comp_unit.reset(
|
|
|
|
frame->GetSymbolContext(eSymbolContextCompUnit).comp_unit);
|
2012-04-06 00:12:35 +08:00
|
|
|
}
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-10-26 11:11:13 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_comp_unit);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBFunction SBFrame::GetFunction() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBFunction, SBFrame, GetFunction);
|
|
|
|
|
2010-12-14 12:58:53 +08:00
|
|
|
SBFunction sb_function;
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
|
|
|
sb_function.reset(
|
|
|
|
frame->GetSymbolContext(eSymbolContextFunction).function);
|
2012-04-06 00:12:35 +08:00
|
|
|
}
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-10-30 12:51:46 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_function);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-10-05 02:37:52 +08:00
|
|
|
SBSymbol SBFrame::GetSymbol() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBSymbol, SBFrame, GetSymbol);
|
|
|
|
|
2010-12-14 12:58:53 +08:00
|
|
|
SBSymbol sb_symbol;
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
|
|
|
sb_symbol.reset(frame->GetSymbolContext(eSymbolContextSymbol).symbol);
|
2012-04-06 00:12:35 +08:00
|
|
|
}
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2019-03-08 06:47:13 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_symbol);
|
2010-10-05 02:37:52 +08:00
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBBlock SBFrame::GetBlock() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBBlock, SBFrame, GetBlock);
|
|
|
|
|
2010-12-14 12:58:53 +08:00
|
|
|
SBBlock sb_block;
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
2019-03-08 06:47:13 +08:00
|
|
|
if (frame)
|
2012-11-29 08:26:19 +08:00
|
|
|
sb_block.SetPtr(frame->GetSymbolContext(eSymbolContextBlock).block);
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_block);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-09-07 12:20:48 +08:00
|
|
|
SBBlock SBFrame::GetFrameBlock() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBBlock, SBFrame, GetFrameBlock);
|
|
|
|
|
2010-12-14 12:58:53 +08:00
|
|
|
SBBlock sb_block;
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
2019-03-08 06:47:13 +08:00
|
|
|
if (frame)
|
2012-11-29 08:26:19 +08:00
|
|
|
sb_block.SetPtr(frame->GetFrameBlock());
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_block);
|
2010-09-07 12:20:48 +08:00
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBLineEntry SBFrame::GetLineEntry() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBLineEntry, SBFrame, GetLineEntry);
|
|
|
|
|
2010-12-14 12:58:53 +08:00
|
|
|
SBLineEntry sb_line_entry;
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
|
|
|
sb_line_entry.SetLineEntry(
|
|
|
|
frame->GetSymbolContext(eSymbolContextLineEntry).line_entry);
|
2012-04-06 00:12:35 +08:00
|
|
|
}
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_line_entry);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t SBFrame::GetFrameID() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBFrame, GetFrameID);
|
|
|
|
|
2012-01-30 15:41:31 +08:00
|
|
|
uint32_t frame_idx = UINT32_MAX;
|
2014-04-04 12:06:10 +08:00
|
|
|
|
2016-06-10 08:37:44 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
|
|
|
|
2013-11-04 17:33:30 +08:00
|
|
|
StackFrame *frame = exe_ctx.GetFramePtr();
|
2012-04-06 00:12:35 +08:00
|
|
|
if (frame)
|
2012-02-18 13:35:26 +08:00
|
|
|
frame_idx = frame->GetFrameIndex();
|
2014-04-04 12:06:10 +08:00
|
|
|
|
2010-10-30 12:51:46 +08:00
|
|
|
return frame_idx;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2015-05-28 11:27:22 +08:00
|
|
|
lldb::addr_t SBFrame::GetCFA() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::addr_t, SBFrame, GetCFA);
|
|
|
|
|
2016-06-10 08:37:44 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
|
|
|
|
2015-05-28 11:27:22 +08:00
|
|
|
StackFrame *frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame)
|
|
|
|
return frame->GetStackID().GetCallFrameAddress();
|
|
|
|
return LLDB_INVALID_ADDRESS;
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
addr_t SBFrame::GetPC() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::addr_t, SBFrame, GetPC);
|
|
|
|
|
2010-12-15 02:39:31 +08:00
|
|
|
addr_t addr = LLDB_INVALID_ADDRESS;
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
2015-09-07 17:58:09 +08:00
|
|
|
addr = frame->GetFrameCodeAddress().GetOpcodeLoadAddress(
|
2018-06-26 21:06:54 +08:00
|
|
|
target, AddressClass::eCode);
|
2012-04-06 00:12:35 +08:00
|
|
|
}
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-10-26 11:11:13 +08:00
|
|
|
|
|
|
|
return addr;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-12-15 02:39:31 +08:00
|
|
|
bool SBFrame::SetPC(addr_t new_pc) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(bool, SBFrame, SetPC, (lldb::addr_t), new_pc);
|
|
|
|
|
2010-10-26 11:11:13 +08:00
|
|
|
bool ret_val = false;
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
|
|
|
ret_val = frame->GetRegisterContext()->SetPC(new_pc);
|
2012-04-06 00:12:35 +08:00
|
|
|
}
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-10-26 11:11:13 +08:00
|
|
|
|
|
|
|
return ret_val;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
addr_t SBFrame::GetSP() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::addr_t, SBFrame, GetSP);
|
|
|
|
|
2010-10-30 12:51:46 +08:00
|
|
|
addr_t addr = LLDB_INVALID_ADDRESS;
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
|
|
|
addr = frame->GetRegisterContext()->GetSP();
|
2012-04-06 00:12:35 +08:00
|
|
|
}
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-10-30 12:51:46 +08:00
|
|
|
|
|
|
|
return addr;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
addr_t SBFrame::GetFP() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::addr_t, SBFrame, GetFP);
|
|
|
|
|
2010-12-15 02:39:31 +08:00
|
|
|
addr_t addr = LLDB_INVALID_ADDRESS;
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
2019-03-08 06:47:13 +08:00
|
|
|
if (frame)
|
2012-11-29 08:26:19 +08:00
|
|
|
addr = frame->GetRegisterContext()->GetFP();
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-10-26 11:11:13 +08:00
|
|
|
|
|
|
|
return addr;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBAddress SBFrame::GetPCAddress() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBAddress, SBFrame, GetPCAddress);
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBAddress sb_addr;
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-11-04 17:33:30 +08:00
|
|
|
StackFrame *frame = exe_ctx.GetFramePtr();
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
2019-03-08 06:47:13 +08:00
|
|
|
if (frame)
|
2012-11-29 08:26:19 +08:00
|
|
|
sb_addr.SetAddress(&frame->GetFrameCodeAddress());
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_addr);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
void SBFrame::Clear() {
|
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(void, SBFrame, Clear);
|
|
|
|
|
|
|
|
m_opaque_sp->Clear();
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-02-03 15:02:37 +08:00
|
|
|
lldb::SBValue SBFrame::GetValueForVariablePath(const char *var_path) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, GetValueForVariablePath,
|
|
|
|
(const char *), var_path);
|
|
|
|
|
2012-02-03 15:02:37 +08:00
|
|
|
SBValue sb_value;
|
2016-06-10 08:37:44 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-11-04 17:33:30 +08:00
|
|
|
StackFrame *frame = exe_ctx.GetFramePtr();
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
|
|
|
if (frame && target) {
|
2012-04-06 10:17:47 +08:00
|
|
|
lldb::DynamicValueType use_dynamic =
|
|
|
|
frame->CalculateTarget()->GetPreferDynamicValue();
|
|
|
|
sb_value = GetValueForVariablePath(var_path, use_dynamic);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_value);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2012-02-03 15:02:37 +08:00
|
|
|
lldb::SBValue SBFrame::GetValueForVariablePath(const char *var_path,
|
2012-04-06 10:17:47 +08:00
|
|
|
DynamicValueType use_dynamic) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, GetValueForVariablePath,
|
|
|
|
(const char *, lldb::DynamicValueType), var_path,
|
|
|
|
use_dynamic);
|
|
|
|
|
2012-04-06 10:17:47 +08:00
|
|
|
SBValue sb_value;
|
|
|
|
if (var_path == nullptr || var_path[0] == '\0') {
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_value);
|
2012-02-03 15:02:37 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-02-03 15:02:37 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-02-03 15:02:37 +08:00
|
|
|
StackFrame *frame = nullptr;
|
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
2012-02-03 15:02:37 +08:00
|
|
|
if (target && process) {
|
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
2012-02-03 15:02:37 +08:00
|
|
|
frame = exe_ctx.GetFramePtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
if (frame) {
|
2012-02-03 15:02:37 +08:00
|
|
|
VariableSP var_sp;
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error;
|
2012-02-03 15:02:37 +08:00
|
|
|
ValueObjectSP value_sp(frame->GetValueForVariableExpressionPath(
|
|
|
|
var_path, eNoDynamicValues,
|
|
|
|
StackFrame::eExpressionPathOptionCheckPtrVsMember |
|
|
|
|
StackFrame::eExpressionPathOptionsAllowDirectIVarAccess,
|
2012-11-29 08:26:19 +08:00
|
|
|
var_sp, error));
|
2012-02-03 15:02:37 +08:00
|
|
|
sb_value.SetSP(value_sp, use_dynamic);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2012-11-29 08:26:19 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_value);
|
2012-02-03 15:02:37 +08:00
|
|
|
}
|
|
|
|
|
2010-12-15 02:39:31 +08:00
|
|
|
SBValue SBFrame::FindVariable(const char *name) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, FindVariable, (const char *),
|
|
|
|
name);
|
|
|
|
|
2011-06-19 04:06:08 +08:00
|
|
|
SBValue value;
|
2016-06-10 08:37:44 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-11-04 17:33:30 +08:00
|
|
|
StackFrame *frame = exe_ctx.GetFramePtr();
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
|
|
|
if (frame && target) {
|
|
|
|
lldb::DynamicValueType use_dynamic =
|
|
|
|
frame->CalculateTarget()->GetPreferDynamicValue();
|
2011-06-19 04:06:08 +08:00
|
|
|
value = FindVariable(name, use_dynamic);
|
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(value);
|
2011-04-16 08:01:13 +08:00
|
|
|
}
|
|
|
|
|
2011-05-04 11:43:18 +08:00
|
|
|
SBValue SBFrame::FindVariable(const char *name,
|
2012-11-29 08:26:19 +08:00
|
|
|
lldb::DynamicValueType use_dynamic) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, FindVariable,
|
|
|
|
(const char *, lldb::DynamicValueType), name, use_dynamic);
|
|
|
|
|
2012-11-29 08:26:19 +08:00
|
|
|
VariableSP var_sp;
|
|
|
|
SBValue sb_value;
|
2011-06-19 04:06:08 +08:00
|
|
|
|
2012-11-29 08:26:19 +08:00
|
|
|
if (name == nullptr || name[0] == '\0') {
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_value);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2012-11-29 08:26:19 +08:00
|
|
|
ValueObjectSP value_sp;
|
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-11-29 08:26:19 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
|
|
|
Process::StopLocker stop_locker;
|
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
2018-09-21 01:06:34 +08:00
|
|
|
value_sp = frame->FindVariable(ConstString(name));
|
|
|
|
|
|
|
|
if (value_sp)
|
2012-11-29 08:26:19 +08:00
|
|
|
sb_value.SetSP(value_sp, use_dynamic);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2014-04-04 12:06:10 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_value);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-12-15 02:39:31 +08:00
|
|
|
SBValue SBFrame::FindValue(const char *name, ValueType value_type) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, FindValue,
|
|
|
|
(const char *, lldb::ValueType), name, value_type);
|
|
|
|
|
2011-06-19 04:06:08 +08:00
|
|
|
SBValue value;
|
2016-06-10 08:37:44 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-11-04 17:33:30 +08:00
|
|
|
StackFrame *frame = exe_ctx.GetFramePtr();
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
|
|
|
if (frame && target) {
|
|
|
|
lldb::DynamicValueType use_dynamic =
|
|
|
|
frame->CalculateTarget()->GetPreferDynamicValue();
|
2011-06-19 04:06:08 +08:00
|
|
|
value = FindValue(name, value_type, use_dynamic);
|
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(value);
|
2011-04-16 08:01:13 +08:00
|
|
|
}
|
|
|
|
|
2011-05-04 11:43:18 +08:00
|
|
|
SBValue SBFrame::FindValue(const char *name, ValueType value_type,
|
|
|
|
lldb::DynamicValueType use_dynamic) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, FindValue,
|
|
|
|
(const char *, lldb::ValueType, lldb::DynamicValueType),
|
|
|
|
name, value_type, use_dynamic);
|
|
|
|
|
2010-12-15 02:39:31 +08:00
|
|
|
SBValue sb_value;
|
2014-04-04 12:06:10 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
if (name == nullptr || name[0] == '\0') {
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_value);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2012-02-04 10:27:34 +08:00
|
|
|
ValueObjectSP value_sp;
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
2014-02-20 03:35:13 +08:00
|
|
|
VariableList variable_list;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-11-29 08:26:19 +08:00
|
|
|
switch (value_type) {
|
|
|
|
case eValueTypeVariableGlobal: // global variable
|
|
|
|
case eValueTypeVariableStatic: // static variable
|
|
|
|
case eValueTypeVariableArgument: // function argument variables
|
|
|
|
case eValueTypeVariableLocal: // function local variables
|
2016-07-02 01:17:23 +08:00
|
|
|
case eValueTypeVariableThreadLocal: // thread local variables
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2012-11-29 08:26:19 +08:00
|
|
|
SymbolContext sc(frame->GetSymbolContext(eSymbolContextBlock));
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-07-02 01:17:23 +08:00
|
|
|
const bool can_create = true;
|
|
|
|
const bool get_parent_variables = true;
|
|
|
|
const bool stop_if_block_is_inlined_function = true;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-07-02 01:17:23 +08:00
|
|
|
if (sc.block)
|
|
|
|
sc.block->AppendVariables(
|
|
|
|
can_create, get_parent_variables,
|
|
|
|
stop_if_block_is_inlined_function,
|
|
|
|
[frame](Variable *v) { return v->IsInScope(frame); },
|
|
|
|
&variable_list);
|
|
|
|
if (value_type == eValueTypeVariableGlobal) {
|
|
|
|
const bool get_file_globals = true;
|
|
|
|
VariableList *frame_vars = frame->GetVariableList(get_file_globals);
|
|
|
|
if (frame_vars)
|
|
|
|
frame_vars->AppendVariablesIfUnique(variable_list);
|
|
|
|
}
|
|
|
|
ConstString const_name(name);
|
|
|
|
VariableSP variable_sp(
|
2012-11-29 08:26:19 +08:00
|
|
|
variable_list.FindVariable(const_name, value_type));
|
|
|
|
if (variable_sp) {
|
|
|
|
value_sp = frame->GetValueObjectForFrameVariable(variable_sp,
|
|
|
|
eNoDynamicValues);
|
|
|
|
sb_value.SetSP(value_sp, use_dynamic);
|
2012-04-06 00:12:35 +08:00
|
|
|
}
|
2012-11-29 08:26:19 +08:00
|
|
|
} break;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-11-29 08:26:19 +08:00
|
|
|
case eValueTypeRegister: // stack frame register value
|
2010-11-20 02:07:14 +08:00
|
|
|
{
|
2012-11-29 08:26:19 +08:00
|
|
|
RegisterContextSP reg_ctx(frame->GetRegisterContext());
|
|
|
|
if (reg_ctx) {
|
|
|
|
const uint32_t num_regs = reg_ctx->GetRegisterCount();
|
|
|
|
for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) {
|
|
|
|
const RegisterInfo *reg_info =
|
|
|
|
reg_ctx->GetRegisterInfoAtIndex(reg_idx);
|
|
|
|
if (reg_info &&
|
|
|
|
((reg_info->name && strcasecmp(reg_info->name, name) == 0) ||
|
|
|
|
(reg_info->alt_name &&
|
|
|
|
strcasecmp(reg_info->alt_name, name) == 0))) {
|
|
|
|
value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_idx);
|
|
|
|
sb_value.SetSP(value_sp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2012-11-29 08:26:19 +08:00
|
|
|
} break;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-11-29 08:26:19 +08:00
|
|
|
case eValueTypeRegisterSet: // A collection of stack frame register
|
|
|
|
// values
|
2016-09-07 04:57:50 +08:00
|
|
|
{
|
2012-11-29 08:26:19 +08:00
|
|
|
RegisterContextSP reg_ctx(frame->GetRegisterContext());
|
|
|
|
if (reg_ctx) {
|
|
|
|
const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
|
|
|
|
for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
|
|
|
|
const RegisterSet *reg_set = reg_ctx->GetRegisterSet(set_idx);
|
|
|
|
if (reg_set &&
|
|
|
|
((reg_set->name && strcasecmp(reg_set->name, name) == 0) ||
|
|
|
|
(reg_set->short_name &&
|
|
|
|
strcasecmp(reg_set->short_name, name) == 0))) {
|
2013-07-26 10:08:48 +08:00
|
|
|
value_sp =
|
2012-11-29 08:26:19 +08:00
|
|
|
ValueObjectRegisterSet::Create(frame, reg_ctx, set_idx);
|
|
|
|
sb_value.SetSP(value_sp);
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
|
|
|
}
|
2012-04-06 00:12:35 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
} break;
|
|
|
|
|
2012-04-06 10:17:47 +08:00
|
|
|
case eValueTypeConstResult: // constant result variables
|
|
|
|
{
|
2012-11-29 08:26:19 +08:00
|
|
|
ConstString const_name(name);
|
|
|
|
ExpressionVariableSP expr_var_sp(
|
|
|
|
target->GetPersistentVariable(const_name));
|
|
|
|
if (expr_var_sp) {
|
|
|
|
value_sp = expr_var_sp->GetValueObject();
|
|
|
|
sb_value.SetSP(value_sp, use_dynamic);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
} break;
|
|
|
|
|
2012-11-29 08:26:19 +08:00
|
|
|
default:
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
2012-04-06 10:17:47 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2014-04-04 12:06:10 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_value);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2012-03-06 03:53:24 +08:00
|
|
|
bool SBFrame::IsEqual(const SBFrame &that) const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST(bool, SBFrame, IsEqual, (const lldb::SBFrame &),
|
|
|
|
that);
|
|
|
|
|
2013-11-04 17:33:30 +08:00
|
|
|
lldb::StackFrameSP this_sp = GetFrameSP();
|
|
|
|
lldb::StackFrameSP that_sp = that.GetFrameSP();
|
2012-03-06 03:53:24 +08:00
|
|
|
return (this_sp && that_sp && this_sp->GetStackID() == that_sp->GetStackID());
|
|
|
|
}
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
bool SBFrame::operator==(const SBFrame &rhs) const {
|
|
|
|
LLDB_RECORD_METHOD_CONST(bool, SBFrame, operator==,(const lldb::SBFrame &),
|
|
|
|
rhs);
|
|
|
|
|
|
|
|
return IsEqual(rhs);
|
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
bool SBFrame::operator!=(const SBFrame &rhs) const {
|
|
|
|
LLDB_RECORD_METHOD_CONST(bool, SBFrame, operator!=,(const lldb::SBFrame &),
|
|
|
|
rhs);
|
|
|
|
|
|
|
|
return !IsEqual(rhs);
|
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
SBThread SBFrame::GetThread() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBThread, SBFrame, GetThread);
|
|
|
|
|
2016-06-10 08:37:44 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
|
|
|
|
2012-02-18 13:35:26 +08:00
|
|
|
ThreadSP thread_sp(exe_ctx.GetThreadSP());
|
|
|
|
SBThread sb_thread(thread_sp);
|
2010-10-26 11:11:13 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_thread);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *SBFrame::Disassemble() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBFrame, Disassemble);
|
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
const char *disassembly = nullptr;
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
|
|
|
disassembly = frame->Disassemble();
|
2012-04-06 00:12:35 +08:00
|
|
|
}
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-10-26 11:11:13 +08:00
|
|
|
|
2010-10-30 12:51:46 +08:00
|
|
|
return disassembly;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBValueList SBFrame::GetVariables(bool arguments, bool locals, bool statics,
|
|
|
|
bool in_scope_only) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBValueList, SBFrame, GetVariables,
|
|
|
|
(bool, bool, bool, bool), arguments, locals, statics,
|
|
|
|
in_scope_only);
|
|
|
|
|
2011-06-19 04:06:08 +08:00
|
|
|
SBValueList value_list;
|
2016-06-10 08:37:44 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-11-04 17:33:30 +08:00
|
|
|
StackFrame *frame = exe_ctx.GetFramePtr();
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
|
|
|
if (frame && target) {
|
|
|
|
lldb::DynamicValueType use_dynamic =
|
|
|
|
frame->CalculateTarget()->GetPreferDynamicValue();
|
2015-02-18 01:55:50 +08:00
|
|
|
const bool include_runtime_support_values =
|
|
|
|
target ? target->GetDisplayRuntimeSupportValues() : false;
|
2011-04-16 08:01:13 +08:00
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
SBVariablesOptions options;
|
|
|
|
options.SetIncludeArguments(arguments);
|
|
|
|
options.SetIncludeLocals(locals);
|
|
|
|
options.SetIncludeStatics(statics);
|
|
|
|
options.SetInScopeOnly(in_scope_only);
|
|
|
|
options.SetIncludeRuntimeSupportValues(include_runtime_support_values);
|
|
|
|
options.SetUseDynamic(use_dynamic);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
value_list = GetVariables(options);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(value_list);
|
2015-02-11 10:35:39 +08:00
|
|
|
}
|
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
lldb::SBValueList SBFrame::GetVariables(bool arguments, bool locals,
|
|
|
|
bool statics, bool in_scope_only,
|
2013-03-28 07:08:40 +08:00
|
|
|
lldb::DynamicValueType use_dynamic) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBValueList, SBFrame, GetVariables,
|
|
|
|
(bool, bool, bool, bool, lldb::DynamicValueType),
|
|
|
|
arguments, locals, statics, in_scope_only, use_dynamic);
|
|
|
|
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2015-02-18 01:55:50 +08:00
|
|
|
const bool include_runtime_support_values =
|
|
|
|
target ? target->GetDisplayRuntimeSupportValues() : false;
|
|
|
|
SBVariablesOptions options;
|
|
|
|
options.SetIncludeArguments(arguments);
|
|
|
|
options.SetIncludeLocals(locals);
|
|
|
|
options.SetIncludeStatics(statics);
|
|
|
|
options.SetInScopeOnly(in_scope_only);
|
|
|
|
options.SetIncludeRuntimeSupportValues(include_runtime_support_values);
|
|
|
|
options.SetUseDynamic(use_dynamic);
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(GetVariables(options));
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
SBValueList SBFrame::GetVariables(const lldb::SBVariablesOptions &options) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBValueList, SBFrame, GetVariables,
|
|
|
|
(const lldb::SBVariablesOptions &), options);
|
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
SBValueList value_list;
|
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-04-30 05:00:38 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-11-29 08:26:19 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-11-29 08:26:19 +08:00
|
|
|
const bool statics = options.GetIncludeStatics();
|
|
|
|
const bool arguments = options.GetIncludeArguments();
|
2018-12-21 07:38:19 +08:00
|
|
|
const bool recognized_arguments =
|
|
|
|
options.GetIncludeRecognizedArguments(SBTarget(exe_ctx.GetTargetSP()));
|
2015-02-18 01:55:50 +08:00
|
|
|
const bool locals = options.GetIncludeLocals();
|
|
|
|
const bool in_scope_only = options.GetInScopeOnly();
|
2012-11-29 08:26:19 +08:00
|
|
|
const bool include_runtime_support_values =
|
|
|
|
options.GetIncludeRuntimeSupportValues();
|
2012-10-17 05:41:58 +08:00
|
|
|
const lldb::DynamicValueType use_dynamic = options.GetUseDynamic();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
|
2012-11-29 08:26:19 +08:00
|
|
|
std::set<VariableSP> variable_set;
|
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
|
|
|
Process::StopLocker stop_locker;
|
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
|
|
|
VariableList *variable_list = nullptr;
|
|
|
|
variable_list = frame->GetVariableList(true);
|
2016-04-30 05:00:38 +08:00
|
|
|
if (variable_list) {
|
|
|
|
const size_t num_variables = variable_list->GetSize();
|
2012-11-29 08:26:19 +08:00
|
|
|
if (num_variables) {
|
2019-11-25 22:03:46 +08:00
|
|
|
for (const VariableSP &variable_sp : *variable_list) {
|
2016-07-02 01:17:23 +08:00
|
|
|
if (variable_sp) {
|
2012-11-29 08:26:19 +08:00
|
|
|
bool add_variable = false;
|
|
|
|
switch (variable_sp->GetScope()) {
|
|
|
|
case eValueTypeVariableGlobal:
|
2015-10-31 09:22:59 +08:00
|
|
|
case eValueTypeVariableStatic:
|
|
|
|
case eValueTypeVariableThreadLocal:
|
|
|
|
add_variable = statics;
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
case eValueTypeVariableArgument:
|
2012-11-29 08:26:19 +08:00
|
|
|
add_variable = arguments;
|
|
|
|
break;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-11-29 08:26:19 +08:00
|
|
|
case eValueTypeVariableLocal:
|
|
|
|
add_variable = locals;
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2012-11-29 08:26:19 +08:00
|
|
|
if (add_variable) {
|
2016-04-30 05:00:38 +08:00
|
|
|
// Only add variables once so we don't end up with duplicates
|
2016-07-02 01:17:23 +08:00
|
|
|
if (variable_set.find(variable_sp) == variable_set.end())
|
2016-04-30 05:00:38 +08:00
|
|
|
variable_set.insert(variable_sp);
|
2016-09-07 04:57:50 +08:00
|
|
|
else
|
2016-04-30 05:00:38 +08:00
|
|
|
continue;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-11-29 08:26:19 +08:00
|
|
|
if (in_scope_only && !variable_sp->IsInScope(frame))
|
2016-04-30 05:00:38 +08:00
|
|
|
continue;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-11-29 08:26:19 +08:00
|
|
|
ValueObjectSP valobj_sp(frame->GetValueObjectForFrameVariable(
|
|
|
|
variable_sp, eNoDynamicValues));
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
if (!include_runtime_support_values && valobj_sp != nullptr &&
|
2015-10-31 09:22:59 +08:00
|
|
|
valobj_sp->IsRuntimeSupportValue())
|
2016-04-30 05:00:38 +08:00
|
|
|
continue;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-11-29 08:26:19 +08:00
|
|
|
SBValue value_sb;
|
2016-07-02 01:17:23 +08:00
|
|
|
value_sb.SetSP(valobj_sp, use_dynamic);
|
2012-11-29 08:26:19 +08:00
|
|
|
value_list.Append(value_sb);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2012-04-06 00:12:35 +08:00
|
|
|
}
|
2014-04-04 12:06:10 +08:00
|
|
|
}
|
2018-10-31 12:00:22 +08:00
|
|
|
if (recognized_arguments) {
|
|
|
|
auto recognized_frame = frame->GetRecognizedFrame();
|
|
|
|
if (recognized_frame) {
|
|
|
|
ValueObjectListSP recognized_arg_list =
|
|
|
|
recognized_frame->GetRecognizedArguments();
|
|
|
|
if (recognized_arg_list) {
|
|
|
|
for (auto &rec_value_sp : recognized_arg_list->GetObjects()) {
|
|
|
|
SBValue value_sb;
|
|
|
|
value_sb.SetSP(rec_value_sp, use_dynamic);
|
|
|
|
value_list.Append(value_sb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-10-26 11:11:13 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(value_list);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBValueList SBFrame::GetRegisters() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(lldb::SBValueList, SBFrame, GetRegisters);
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBValueList value_list;
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
|
|
|
RegisterContextSP reg_ctx(frame->GetRegisterContext());
|
|
|
|
if (reg_ctx) {
|
|
|
|
const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
|
|
|
|
for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
|
|
|
|
value_list.Append(
|
|
|
|
ValueObjectRegisterSet::Create(frame, reg_ctx, set_idx));
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2014-04-04 12:06:10 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-10-26 11:11:13 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(value_list);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2013-07-26 10:08:48 +08:00
|
|
|
SBValue SBFrame::FindRegister(const char *name) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, FindRegister, (const char *),
|
|
|
|
name);
|
|
|
|
|
2013-07-26 10:08:48 +08:00
|
|
|
SBValue result;
|
|
|
|
ValueObjectSP value_sp;
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2013-07-26 10:08:48 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
|
|
|
Process::StopLocker stop_locker;
|
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
|
|
|
RegisterContextSP reg_ctx(frame->GetRegisterContext());
|
|
|
|
if (reg_ctx) {
|
|
|
|
const uint32_t num_regs = reg_ctx->GetRegisterCount();
|
|
|
|
for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) {
|
|
|
|
const RegisterInfo *reg_info =
|
|
|
|
reg_ctx->GetRegisterInfoAtIndex(reg_idx);
|
|
|
|
if (reg_info &&
|
|
|
|
((reg_info->name && strcasecmp(reg_info->name, name) == 0) ||
|
|
|
|
(reg_info->alt_name &&
|
|
|
|
strcasecmp(reg_info->alt_name, name) == 0))) {
|
|
|
|
value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_idx);
|
|
|
|
result.SetSP(value_sp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2014-04-04 12:06:10 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2013-07-26 10:08:48 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2013-07-26 10:08:48 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(result);
|
2013-07-26 10:08:48 +08:00
|
|
|
}
|
|
|
|
|
2010-09-20 13:20:02 +08:00
|
|
|
bool SBFrame::GetDescription(SBStream &description) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(bool, SBFrame, GetDescription, (lldb::SBStream &),
|
|
|
|
description);
|
|
|
|
|
2011-11-13 14:57:31 +08:00
|
|
|
Stream &strm = description.ref();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-05-19 13:13:57 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-11-04 17:33:30 +08:00
|
|
|
StackFrame *frame;
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
|
|
|
frame->DumpUsingSettingsFormat(&strm);
|
2012-04-06 00:12:35 +08:00
|
|
|
}
|
2010-09-20 13:20:02 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
} else
|
2010-09-20 13:20:02 +08:00
|
|
|
strm.PutCString("No value");
|
2010-10-05 08:00:42 +08:00
|
|
|
|
2012-10-17 05:41:58 +08:00
|
|
|
return true;
|
2011-04-16 08:01:13 +08:00
|
|
|
}
|
|
|
|
|
2011-05-04 11:43:18 +08:00
|
|
|
SBValue SBFrame::EvaluateExpression(const char *expr) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, EvaluateExpression, (const char *),
|
|
|
|
expr);
|
|
|
|
|
2011-05-04 11:43:18 +08:00
|
|
|
SBValue result;
|
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-05-04 11:43:18 +08:00
|
|
|
StackFrame *frame = exe_ctx.GetFramePtr();
|
2015-02-11 10:35:39 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-05-12 07:47:32 +08:00
|
|
|
if (frame && target) {
|
2012-10-17 05:41:58 +08:00
|
|
|
SBExpressionOptions options;
|
2012-10-17 06:58:25 +08:00
|
|
|
lldb::DynamicValueType fetch_dynamic_value =
|
2012-10-17 05:41:58 +08:00
|
|
|
frame->CalculateTarget()->GetPreferDynamicValue();
|
2012-10-17 06:58:25 +08:00
|
|
|
options.SetFetchDynamicValue(fetch_dynamic_value);
|
2012-10-17 05:41:58 +08:00
|
|
|
options.SetUnwindOnError(true);
|
2016-01-29 18:48:11 +08:00
|
|
|
options.SetIgnoreBreakpoints(true);
|
2015-11-03 03:30:40 +08:00
|
|
|
if (target->GetLanguage() != eLanguageTypeUnknown)
|
|
|
|
options.SetLanguage(target->GetLanguage());
|
|
|
|
else
|
|
|
|
options.SetLanguage(frame->GetLanguage());
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(EvaluateExpression(expr, options));
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(result);
|
2012-05-12 07:47:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBValue
|
|
|
|
SBFrame::EvaluateExpression(const char *expr,
|
|
|
|
lldb::DynamicValueType fetch_dynamic_value) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, EvaluateExpression,
|
|
|
|
(const char *, lldb::DynamicValueType), expr,
|
|
|
|
fetch_dynamic_value);
|
|
|
|
|
2012-10-17 05:41:58 +08:00
|
|
|
SBExpressionOptions options;
|
2012-10-17 06:58:25 +08:00
|
|
|
options.SetFetchDynamicValue(fetch_dynamic_value);
|
2012-10-17 05:41:58 +08:00
|
|
|
options.SetUnwindOnError(true);
|
2016-01-29 18:48:11 +08:00
|
|
|
options.SetIgnoreBreakpoints(true);
|
2016-06-10 08:37:44 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-11-03 03:30:40 +08:00
|
|
|
StackFrame *frame = exe_ctx.GetFramePtr();
|
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
|
|
|
if (target && target->GetLanguage() != eLanguageTypeUnknown)
|
|
|
|
options.SetLanguage(target->GetLanguage());
|
|
|
|
else if (frame)
|
|
|
|
options.SetLanguage(frame->GetLanguage());
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(EvaluateExpression(expr, options));
|
2012-10-17 05:41:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBValue SBFrame::EvaluateExpression(const char *expr,
|
|
|
|
lldb::DynamicValueType fetch_dynamic_value,
|
2012-05-12 07:47:32 +08:00
|
|
|
bool unwind_on_error) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, EvaluateExpression,
|
|
|
|
(const char *, lldb::DynamicValueType, bool), expr,
|
|
|
|
fetch_dynamic_value, unwind_on_error);
|
|
|
|
|
2012-10-17 05:41:58 +08:00
|
|
|
SBExpressionOptions options;
|
2016-06-10 08:37:44 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-10-17 06:58:25 +08:00
|
|
|
options.SetFetchDynamicValue(fetch_dynamic_value);
|
2012-10-17 05:41:58 +08:00
|
|
|
options.SetUnwindOnError(unwind_on_error);
|
2016-01-29 18:48:11 +08:00
|
|
|
options.SetIgnoreBreakpoints(true);
|
2013-11-04 17:33:30 +08:00
|
|
|
StackFrame *frame = exe_ctx.GetFramePtr();
|
2015-02-11 10:35:39 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-10-17 05:41:58 +08:00
|
|
|
if (target && target->GetLanguage() != eLanguageTypeUnknown)
|
2015-11-03 03:30:40 +08:00
|
|
|
options.SetLanguage(target->GetLanguage());
|
2012-11-29 08:26:19 +08:00
|
|
|
else if (frame)
|
2015-11-03 03:30:40 +08:00
|
|
|
options.SetLanguage(frame->GetLanguage());
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(EvaluateExpression(expr, options));
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2010-10-05 08:00:42 +08:00
|
|
|
lldb::SBValue SBFrame::EvaluateExpression(const char *expr,
|
2012-10-17 05:41:58 +08:00
|
|
|
const SBExpressionOptions &options) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBValue, SBFrame, EvaluateExpression,
|
|
|
|
(const char *, const lldb::SBExpressionOptions &), expr,
|
|
|
|
options);
|
|
|
|
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *expr_log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
|
2010-10-30 12:51:46 +08:00
|
|
|
|
2010-12-15 02:39:31 +08:00
|
|
|
SBValue expr_result;
|
2012-08-23 05:34:33 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
if (expr == nullptr || expr[0] == '\0') {
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(expr_result);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2012-02-04 10:27:34 +08:00
|
|
|
ValueObjectSP expr_value_sp;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-06-10 08:37:44 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-11-29 08:26:19 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-11-29 08:26:19 +08:00
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
2016-12-15 08:30:30 +08:00
|
|
|
std::unique_ptr<llvm::PrettyStackTraceFormat> stack_trace;
|
2013-12-07 05:59:52 +08:00
|
|
|
if (target->GetDisplayExpressionsInCrashlogs()) {
|
|
|
|
StreamString frame_description;
|
|
|
|
frame->DumpUsingSettingsFormat(&frame_description);
|
2019-08-15 06:19:23 +08:00
|
|
|
stack_trace = std::make_unique<llvm::PrettyStackTraceFormat>(
|
2013-12-07 05:59:52 +08:00
|
|
|
"SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value "
|
|
|
|
"= %u) %s",
|
|
|
|
expr, options.GetFetchDynamicValue(),
|
2016-11-17 05:15:24 +08:00
|
|
|
frame_description.GetData());
|
2013-12-07 05:59:52 +08:00
|
|
|
}
|
2014-04-04 12:06:10 +08:00
|
|
|
|
2019-03-19 00:04:46 +08:00
|
|
|
target->EvaluateExpression(expr, frame, expr_value_sp, options.ref());
|
2012-11-29 08:26:19 +08:00
|
|
|
expr_result.SetSP(expr_value_sp, options.GetFetchDynamicValue());
|
2012-04-06 00:12:35 +08:00
|
|
|
}
|
2010-10-05 08:00:42 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2012-02-21 13:33:55 +08:00
|
|
|
|
2019-07-25 01:56:10 +08:00
|
|
|
LLDB_LOGF(expr_log,
|
|
|
|
"** [SBFrame::EvaluateExpression] Expression result is "
|
|
|
|
"%s, summary %s **",
|
|
|
|
expr_result.GetValue(), expr_result.GetSummary());
|
2010-10-30 12:51:46 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(expr_result);
|
2010-10-05 08:00:42 +08:00
|
|
|
}
|
2011-06-19 04:06:08 +08:00
|
|
|
|
2015-06-25 02:35:36 +08:00
|
|
|
bool SBFrame::IsInlined() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(bool, SBFrame, IsInlined);
|
|
|
|
|
2015-06-26 01:41:41 +08:00
|
|
|
return static_cast<const SBFrame *>(this)->IsInlined();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SBFrame::IsInlined() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBFrame, IsInlined);
|
|
|
|
|
2016-06-10 08:37:44 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-11-29 08:26:19 +08:00
|
|
|
Block *block = frame->GetSymbolContext(eSymbolContextBlock).block;
|
|
|
|
if (block)
|
2015-10-31 09:22:59 +08:00
|
|
|
return block->GetContainingInlinedBlock() != nullptr;
|
2012-04-06 00:12:35 +08:00
|
|
|
}
|
2011-06-19 04:06:08 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2011-06-19 04:06:08 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-10-06 07:23:15 +08:00
|
|
|
bool SBFrame::IsArtificial() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(bool, SBFrame, IsArtificial);
|
|
|
|
|
2018-10-06 07:23:15 +08:00
|
|
|
return static_cast<const SBFrame *>(this)->IsArtificial();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SBFrame::IsArtificial() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBFrame, IsArtificial);
|
|
|
|
|
2018-10-06 07:23:15 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
|
|
|
|
|
|
|
StackFrame *frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame)
|
|
|
|
return frame->IsArtificial();
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-06-25 02:35:36 +08:00
|
|
|
const char *SBFrame::GetFunctionName() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(const char *, SBFrame, GetFunctionName);
|
|
|
|
|
2015-06-26 01:41:41 +08:00
|
|
|
return static_cast<const SBFrame *>(this)->GetFunctionName();
|
|
|
|
}
|
|
|
|
|
2017-04-12 08:19:54 +08:00
|
|
|
lldb::LanguageType SBFrame::GuessLanguage() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::LanguageType, SBFrame, GuessLanguage);
|
|
|
|
|
2017-04-12 08:19:54 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2017-04-12 08:19:54 +08:00
|
|
|
StackFrame *frame = nullptr;
|
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
|
|
|
Process::StopLocker stop_locker;
|
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
|
|
|
return frame->GuessLanguage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return eLanguageTypeUnknown;
|
|
|
|
}
|
|
|
|
|
2015-06-26 01:41:41 +08:00
|
|
|
const char *SBFrame::GetFunctionName() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBFrame, GetFunctionName);
|
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
const char *name = nullptr;
|
2016-06-10 08:37:44 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2012-02-18 13:35:26 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
2012-11-29 08:26:19 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
2012-04-06 00:12:35 +08:00
|
|
|
Process::StopLocker stop_locker;
|
2012-11-29 08:26:19 +08:00
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
|
|
|
SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction |
|
|
|
|
eSymbolContextBlock |
|
|
|
|
eSymbolContextSymbol));
|
|
|
|
if (sc.block) {
|
|
|
|
Block *inlined_block = sc.block->GetContainingInlinedBlock();
|
|
|
|
if (inlined_block) {
|
|
|
|
const InlineFunctionInfo *inlined_info =
|
|
|
|
inlined_block->GetInlinedFunctionInfo();
|
2015-07-09 06:32:23 +08:00
|
|
|
name =
|
|
|
|
inlined_info->GetName(sc.function->GetLanguage()).AsCString();
|
2012-11-29 08:26:19 +08:00
|
|
|
}
|
2012-04-06 00:12:35 +08:00
|
|
|
}
|
2011-06-19 04:06:08 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
if (name == nullptr) {
|
2012-11-29 08:26:19 +08:00
|
|
|
if (sc.function)
|
|
|
|
name = sc.function->GetName().GetCString();
|
2011-06-19 04:06:08 +08:00
|
|
|
}
|
2012-04-06 10:17:47 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
if (name == nullptr) {
|
2015-07-07 02:28:46 +08:00
|
|
|
if (sc.symbol)
|
|
|
|
name = sc.symbol->GetName().GetCString();
|
2012-04-06 10:17:47 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2011-06-19 04:06:08 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2011-06-19 04:06:08 +08:00
|
|
|
return name;
|
|
|
|
}
|
2015-07-07 02:28:46 +08:00
|
|
|
|
|
|
|
const char *SBFrame::GetDisplayFunctionName() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(const char *, SBFrame, GetDisplayFunctionName);
|
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
const char *name = nullptr;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-06-10 08:37:44 +08:00
|
|
|
std::unique_lock<std::recursive_mutex> lock;
|
|
|
|
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
StackFrame *frame = nullptr;
|
2015-07-07 02:28:46 +08:00
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
if (target && process) {
|
|
|
|
Process::StopLocker stop_locker;
|
|
|
|
if (stop_locker.TryLock(&process->GetRunLock())) {
|
|
|
|
frame = exe_ctx.GetFramePtr();
|
|
|
|
if (frame) {
|
|
|
|
SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction |
|
|
|
|
eSymbolContextBlock |
|
|
|
|
eSymbolContextSymbol));
|
|
|
|
if (sc.block) {
|
|
|
|
Block *inlined_block = sc.block->GetContainingInlinedBlock();
|
2015-07-09 06:32:23 +08:00
|
|
|
if (inlined_block) {
|
2015-07-07 02:28:46 +08:00
|
|
|
const InlineFunctionInfo *inlined_info =
|
|
|
|
inlined_block->GetInlinedFunctionInfo();
|
|
|
|
name = inlined_info->GetDisplayName(sc.function->GetLanguage())
|
|
|
|
.AsCString();
|
|
|
|
}
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-07-07 02:28:46 +08:00
|
|
|
if (name == nullptr) {
|
|
|
|
if (sc.function)
|
|
|
|
name = sc.function->GetDisplayName().GetCString();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2015-10-31 09:22:59 +08:00
|
|
|
if (name == nullptr) {
|
2015-07-07 02:28:46 +08:00
|
|
|
if (sc.symbol)
|
|
|
|
name = sc.symbol->GetDisplayName().GetCString();
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2015-07-07 02:28:46 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2015-07-07 02:28:46 +08:00
|
|
|
return name;
|
|
|
|
}
|
2019-03-20 01:13:13 +08:00
|
|
|
|
|
|
|
namespace lldb_private {
|
|
|
|
namespace repro {
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void RegisterMethods<SBFrame>(Registry &R) {
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBFrame, ());
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBFrame, (const lldb::StackFrameSP &));
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBFrame, (const lldb::SBFrame &));
|
|
|
|
LLDB_REGISTER_METHOD(const lldb::SBFrame &,
|
|
|
|
SBFrame, operator=,(const lldb::SBFrame &));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBFrame, IsValid, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBFrame, operator bool, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBSymbolContext, SBFrame, GetSymbolContext,
|
|
|
|
(uint32_t));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBModule, SBFrame, GetModule, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBCompileUnit, SBFrame, GetCompileUnit,
|
|
|
|
());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBFunction, SBFrame, GetFunction, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBSymbol, SBFrame, GetSymbol, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBBlock, SBFrame, GetBlock, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBBlock, SBFrame, GetFrameBlock, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBLineEntry, SBFrame, GetLineEntry, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(uint32_t, SBFrame, GetFrameID, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::addr_t, SBFrame, GetCFA, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::addr_t, SBFrame, GetPC, ());
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBFrame, SetPC, (lldb::addr_t));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::addr_t, SBFrame, GetSP, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::addr_t, SBFrame, GetFP, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBAddress, SBFrame, GetPCAddress, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBFrame, Clear, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, GetValueForVariablePath,
|
|
|
|
(const char *));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, GetValueForVariablePath,
|
|
|
|
(const char *, lldb::DynamicValueType));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, FindVariable, (const char *));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, FindVariable,
|
|
|
|
(const char *, lldb::DynamicValueType));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, FindValue,
|
|
|
|
(const char *, lldb::ValueType));
|
|
|
|
LLDB_REGISTER_METHOD(
|
|
|
|
lldb::SBValue, SBFrame, FindValue,
|
|
|
|
(const char *, lldb::ValueType, lldb::DynamicValueType));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBFrame, IsEqual, (const lldb::SBFrame &));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool,
|
|
|
|
SBFrame, operator==,(const lldb::SBFrame &));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool,
|
|
|
|
SBFrame, operator!=,(const lldb::SBFrame &));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBThread, SBFrame, GetThread, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(const char *, SBFrame, Disassemble, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBValueList, SBFrame, GetVariables,
|
|
|
|
(bool, bool, bool, bool));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBValueList, SBFrame, GetVariables,
|
|
|
|
(bool, bool, bool, bool, lldb::DynamicValueType));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBValueList, SBFrame, GetVariables,
|
|
|
|
(const lldb::SBVariablesOptions &));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBValueList, SBFrame, GetRegisters, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, FindRegister, (const char *));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBFrame, GetDescription, (lldb::SBStream &));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, EvaluateExpression,
|
|
|
|
(const char *));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, EvaluateExpression,
|
|
|
|
(const char *, lldb::DynamicValueType));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, EvaluateExpression,
|
|
|
|
(const char *, lldb::DynamicValueType, bool));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBValue, SBFrame, EvaluateExpression,
|
|
|
|
(const char *, const lldb::SBExpressionOptions &));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBFrame, IsInlined, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBFrame, IsInlined, ());
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBFrame, IsArtificial, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBFrame, IsArtificial, ());
|
|
|
|
LLDB_REGISTER_METHOD(const char *, SBFrame, GetFunctionName, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::LanguageType, SBFrame, GuessLanguage, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(const char *, SBFrame, GetFunctionName, ());
|
|
|
|
LLDB_REGISTER_METHOD(const char *, SBFrame, GetDisplayFunctionName, ());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|