2010-06-09 00:52:24 +08:00
|
|
|
//===-- SBBreakpointLocation.cpp --------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/API/SBBreakpointLocation.h"
|
2011-09-24 09:37:21 +08:00
|
|
|
#include "lldb/API/SBAddress.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/API/SBDebugger.h"
|
2016-09-07 04:57:50 +08:00
|
|
|
#include "lldb/API/SBDefines.h"
|
2010-09-20 13:20:02 +08:00
|
|
|
#include "lldb/API/SBStream.h"
|
2017-08-02 08:16:10 +08:00
|
|
|
#include "lldb/API/SBStringList.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2010-11-19 02:52:36 +08:00
|
|
|
#include "lldb/Breakpoint/Breakpoint.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Breakpoint/BreakpointLocation.h"
|
2014-04-02 09:04:55 +08:00
|
|
|
#include "lldb/Core/Debugger.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Core/StreamFile.h"
|
2014-04-02 09:04:55 +08:00
|
|
|
#include "lldb/Interpreter/CommandInterpreter.h"
|
|
|
|
#include "lldb/Interpreter/ScriptInterpreter.h"
|
2010-12-21 04:49:23 +08:00
|
|
|
#include "lldb/Target/Target.h"
|
2010-06-18 09:47:08 +08:00
|
|
|
#include "lldb/Target/ThreadSpec.h"
|
2017-03-04 04:56:28 +08:00
|
|
|
#include "lldb/Utility/Log.h"
|
2017-02-03 05:39:50 +08:00
|
|
|
#include "lldb/Utility/Stream.h"
|
2016-09-07 04:57:50 +08:00
|
|
|
#include "lldb/lldb-defines.h"
|
|
|
|
#include "lldb/lldb-types.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
SBBreakpointLocation::SBBreakpointLocation() {}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
SBBreakpointLocation::SBBreakpointLocation(
|
|
|
|
const lldb::BreakpointLocationSP &break_loc_sp)
|
2017-03-01 18:08:48 +08:00
|
|
|
: m_opaque_wp(break_loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
|
|
|
|
|
|
|
|
if (log) {
|
|
|
|
SBStream sstr;
|
|
|
|
GetDescription(sstr, lldb::eDescriptionLevelBrief);
|
2017-03-01 18:08:48 +08:00
|
|
|
LLDB_LOG(log, "location = {0} ({1})", break_loc_sp.get(), sstr.GetData());
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBBreakpointLocation::SBBreakpointLocation(const SBBreakpointLocation &rhs)
|
2017-03-01 18:08:48 +08:00
|
|
|
: m_opaque_wp(rhs.m_opaque_wp) {}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
const SBBreakpointLocation &SBBreakpointLocation::
|
|
|
|
operator=(const SBBreakpointLocation &rhs) {
|
2017-03-01 18:08:48 +08:00
|
|
|
m_opaque_wp = rhs.m_opaque_wp;
|
2016-09-07 04:57:50 +08:00
|
|
|
return *this;
|
2010-11-06 07:17:00 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBBreakpointLocation::~SBBreakpointLocation() {}
|
2010-11-06 07:17:00 +08:00
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP SBBreakpointLocation::GetSP() const {
|
|
|
|
return m_opaque_wp.lock();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpointLocation::IsValid() const { return bool(GetSP()); }
|
2010-11-06 07:17:00 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBAddress SBBreakpointLocation::GetAddress() {
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp)
|
|
|
|
return SBAddress(&loc_sp->GetAddress());
|
2016-09-07 04:57:50 +08:00
|
|
|
else
|
|
|
|
return SBAddress();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
addr_t SBBreakpointLocation::GetLoadAddress() {
|
|
|
|
addr_t ret_addr = LLDB_INVALID_ADDRESS;
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
2011-09-24 09:04:57 +08:00
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
ret_addr = loc_sp->GetLoadAddress();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
return ret_addr;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBBreakpointLocation::SetEnabled(bool enabled) {
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetEnabled(enabled);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool SBBreakpointLocation::IsEnabled() {
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->IsEnabled();
|
2016-09-07 04:57:50 +08:00
|
|
|
} else
|
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2017-07-19 22:31:19 +08:00
|
|
|
uint32_t SBBreakpointLocation::GetHitCount() {
|
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->GetHitCount();
|
|
|
|
} else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t SBBreakpointLocation::GetIgnoreCount() {
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->GetIgnoreCount();
|
2016-09-07 04:57:50 +08:00
|
|
|
} else
|
|
|
|
return 0;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBBreakpointLocation::SetIgnoreCount(uint32_t n) {
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetIgnoreCount(n);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBBreakpointLocation::SetCondition(const char *condition) {
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetCondition(condition);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-10-22 09:15:49 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
const char *SBBreakpointLocation::GetCondition() {
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->GetConditionText();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
return NULL;
|
2010-10-22 09:15:49 +08:00
|
|
|
}
|
|
|
|
|
2017-08-04 02:13:24 +08:00
|
|
|
void SBBreakpointLocation::SetAutoContinue(bool auto_continue) {
|
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetAutoContinue(auto_continue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpointLocation::GetAutoContinue() {
|
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->IsAutoContinue();
|
|
|
|
}
|
2017-08-04 03:38:38 +08:00
|
|
|
return false;
|
2017-08-04 02:13:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBBreakpointLocation::SetScriptCallbackFunction(
|
|
|
|
const char *callback_function_name) {
|
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
LLDB_LOG(log, "location = {0}, callback = {1}", loc_sp.get(),
|
|
|
|
callback_function_name);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
BreakpointOptions *bp_options = loc_sp->GetLocationOptions();
|
|
|
|
loc_sp->GetBreakpoint()
|
2016-09-07 04:57:50 +08:00
|
|
|
.GetTarget()
|
|
|
|
.GetDebugger()
|
|
|
|
.GetCommandInterpreter()
|
|
|
|
.GetScriptInterpreter()
|
|
|
|
->SetBreakpointCommandCallbackFunction(bp_options,
|
|
|
|
callback_function_name);
|
|
|
|
}
|
2014-04-02 09:04:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBError
|
2016-09-07 04:57:50 +08:00
|
|
|
SBBreakpointLocation::SetScriptCallbackBody(const char *callback_body_text) {
|
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
LLDB_LOG(log, "location = {0}: callback body:\n{1}", loc_sp.get(),
|
|
|
|
callback_body_text);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
SBError sb_error;
|
2017-03-01 18:08:48 +08:00
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
BreakpointOptions *bp_options = loc_sp->GetLocationOptions();
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error =
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetBreakpoint()
|
2016-09-07 04:57:50 +08:00
|
|
|
.GetTarget()
|
|
|
|
.GetDebugger()
|
|
|
|
.GetCommandInterpreter()
|
|
|
|
.GetScriptInterpreter()
|
|
|
|
->SetBreakpointCommandCallback(bp_options, callback_body_text);
|
|
|
|
sb_error.SetError(error);
|
|
|
|
} else
|
|
|
|
sb_error.SetErrorString("invalid breakpoint");
|
|
|
|
|
|
|
|
return sb_error;
|
2014-04-02 09:04:55 +08:00
|
|
|
}
|
|
|
|
|
2017-08-02 08:16:10 +08:00
|
|
|
void SBBreakpointLocation::SetCommandLineCommands(SBStringList &commands) {
|
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (!loc_sp)
|
|
|
|
return;
|
|
|
|
if (commands.GetSize() == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
std::unique_ptr<BreakpointOptions::CommandData> cmd_data_up(
|
|
|
|
new BreakpointOptions::CommandData(*commands, eScriptLanguageNone));
|
|
|
|
|
|
|
|
loc_sp->GetLocationOptions()->SetCommandDataCallback(cmd_data_up);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SBBreakpointLocation::GetCommandLineCommands(SBStringList &commands) {
|
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (!loc_sp)
|
|
|
|
return false;
|
|
|
|
StringList command_list;
|
|
|
|
bool has_commands =
|
|
|
|
loc_sp->GetLocationOptions()->GetCommandLineCallbacks(command_list);
|
|
|
|
if (has_commands)
|
|
|
|
commands.AppendList(command_list);
|
|
|
|
return has_commands;
|
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBBreakpointLocation::SetThreadID(tid_t thread_id) {
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetThreadID(thread_id);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
tid_t SBBreakpointLocation::GetThreadID() {
|
|
|
|
tid_t tid = LLDB_INVALID_THREAD_ID;
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->GetThreadID();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
return tid;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBBreakpointLocation::SetThreadIndex(uint32_t index) {
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetThreadIndex(index);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-18 09:47:08 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t SBBreakpointLocation::GetThreadIndex() const {
|
|
|
|
uint32_t thread_idx = UINT32_MAX;
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->GetThreadIndex();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
return thread_idx;
|
2010-06-18 09:47:08 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBBreakpointLocation::SetThreadName(const char *thread_name) {
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetThreadName(thread_name);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-18 09:47:08 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
const char *SBBreakpointLocation::GetThreadName() const {
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->GetThreadName();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
return NULL;
|
2010-06-18 09:47:08 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBBreakpointLocation::SetQueueName(const char *queue_name) {
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->SetQueueName(queue_name);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-18 09:47:08 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
const char *SBBreakpointLocation::GetQueueName() const {
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->GetQueueName();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
return NULL;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool SBBreakpointLocation::IsResolved() {
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->IsResolved();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void SBBreakpointLocation::SetLocation(
|
|
|
|
const lldb::BreakpointLocationSP &break_loc_sp) {
|
|
|
|
// Uninstall the callbacks?
|
2017-03-01 18:08:48 +08:00
|
|
|
m_opaque_wp = break_loc_sp;
|
2010-09-20 13:20:02 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool SBBreakpointLocation::GetDescription(SBStream &description,
|
|
|
|
DescriptionLevel level) {
|
|
|
|
Stream &strm = description.ref();
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-03-01 18:08:48 +08:00
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
loc_sp->GetDescription(&strm, level);
|
2016-09-07 04:57:50 +08:00
|
|
|
strm.EOL();
|
|
|
|
} else
|
|
|
|
strm.PutCString("No value");
|
|
|
|
|
|
|
|
return true;
|
2012-05-16 08:51:15 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
break_id_t SBBreakpointLocation::GetID() {
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
return loc_sp->GetID();
|
2016-09-07 04:57:50 +08:00
|
|
|
} else
|
|
|
|
return LLDB_INVALID_BREAK_ID;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SBBreakpoint SBBreakpointLocation::GetBreakpoint() {
|
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
|
2017-03-01 18:08:48 +08:00
|
|
|
BreakpointLocationSP loc_sp = GetSP();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
SBBreakpoint sb_bp;
|
2017-03-01 18:08:48 +08:00
|
|
|
if (loc_sp) {
|
2016-09-07 04:57:50 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(
|
2017-03-01 18:08:48 +08:00
|
|
|
loc_sp->GetTarget().GetAPIMutex());
|
|
|
|
sb_bp = loc_sp->GetBreakpoint().shared_from_this();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (log) {
|
|
|
|
SBStream sstr;
|
|
|
|
sb_bp.GetDescription(sstr);
|
2017-03-01 18:08:48 +08:00
|
|
|
LLDB_LOG(log, "location = {0}, breakpoint = {1} ({2})", loc_sp.get(),
|
|
|
|
sb_bp.GetSP().get(), sstr.GetData());
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
return sb_bp;
|
|
|
|
}
|