[lldb][NFC] Fix all formatting errors in .cpp file headers
Summary:
A *.cpp file header in LLDB (and in LLDB) should like this:
```
//===-- TestUtilities.cpp -------------------------------------------------===//
```
However in LLDB most of our source files have arbitrary changes to this format and
these changes are spreading through LLDB as folks usually just use the existing
source files as templates for their new files (most notably the unnecessary
editor language indicator `-*- C++ -*-` is spreading and in every review
someone is pointing out that this is wrong, resulting in people pointing out that this
is done in the same way in other files).
This patch removes most of these inconsistencies including the editor language indicators,
all the different missing/additional '-' characters, files that center the file name, missing
trailing `===//` (mostly caused by clang-format breaking the line).
Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D73258
2020-01-24 15:23:27 +08:00
|
|
|
//===-- BreakpointLocation.cpp --------------------------------------------===//
|
2010-06-09 00:52:24 +08:00
|
|
|
//
|
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 "lldb/Breakpoint/BreakpointLocation.h"
|
|
|
|
#include "lldb/Breakpoint/BreakpointID.h"
|
|
|
|
#include "lldb/Breakpoint/StoppointCallbackContext.h"
|
2011-06-03 07:58:26 +08:00
|
|
|
#include "lldb/Core/Debugger.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/Core/Module.h"
|
2015-03-04 07:11:11 +08:00
|
|
|
#include "lldb/Core/ValueObject.h"
|
2016-03-19 08:03:59 +08:00
|
|
|
#include "lldb/Expression/DiagnosticManager.h"
|
2015-09-22 00:56:08 +08:00
|
|
|
#include "lldb/Expression/ExpressionVariable.h"
|
2015-09-16 05:13:50 +08:00
|
|
|
#include "lldb/Expression/UserExpression.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/CompileUnit.h"
|
|
|
|
#include "lldb/Symbol/Symbol.h"
|
2015-09-16 05:13:50 +08:00
|
|
|
#include "lldb/Symbol/TypeSystem.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Target/Process.h"
|
|
|
|
#include "lldb/Target/Target.h"
|
|
|
|
#include "lldb/Target/Thread.h"
|
2010-06-16 10:00:15 +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/StreamString.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2016-05-19 13:13:57 +08:00
|
|
|
BreakpointLocation::BreakpointLocation(break_id_t loc_id, Breakpoint &owner,
|
|
|
|
const Address &addr, lldb::tid_t tid,
|
|
|
|
bool hardware, bool check_for_resolver)
|
2020-07-23 23:41:14 +08:00
|
|
|
: m_being_created(true), m_should_resolve_indirect_functions(false),
|
2016-05-19 13:13:57 +08:00
|
|
|
m_is_reexported(false), m_is_indirect(false), m_address(addr),
|
2020-07-23 23:41:14 +08:00
|
|
|
m_owner(owner), m_options_up(), m_bp_site_sp(), m_condition_mutex(),
|
|
|
|
m_condition_hash(0), m_loc_id(loc_id), m_hit_counter() {
|
2014-01-11 07:46:59 +08:00
|
|
|
if (check_for_resolver) {
|
|
|
|
Symbol *symbol = m_address.CalculateSymbolContextSymbol();
|
|
|
|
if (symbol && symbol->IsIndirect()) {
|
2016-05-19 13:13:57 +08:00
|
|
|
SetShouldResolveIndirectFunctions(true);
|
2014-01-11 07:46:59 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2016-05-19 13:13:57 +08:00
|
|
|
|
|
|
|
SetThreadID(tid);
|
2012-02-08 13:23:15 +08:00
|
|
|
m_being_created = false;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
BreakpointLocation::~BreakpointLocation() { ClearBreakpointSite(); }
|
|
|
|
|
2010-06-14 12:18:27 +08:00
|
|
|
lldb::addr_t BreakpointLocation::GetLoadAddress() const {
|
Added new lldb_private::Process memory read/write functions to stop a bunch
of duplicated code from appearing all over LLDB:
lldb::addr_t
Process::ReadPointerFromMemory (lldb::addr_t vm_addr, Error &error);
bool
Process::WritePointerToMemory (lldb::addr_t vm_addr, lldb::addr_t ptr_value, Error &error);
size_t
Process::ReadScalarIntegerFromMemory (lldb::addr_t addr, uint32_t byte_size, bool is_signed, Scalar &scalar, Error &error);
size_t
Process::WriteScalarToMemory (lldb::addr_t vm_addr, const Scalar &scalar, uint32_t size, Error &error);
in lldb_private::Process the following functions were renamed:
From:
uint64_t
Process::ReadUnsignedInteger (lldb::addr_t load_addr,
size_t byte_size,
Error &error);
To:
uint64_t
Process::ReadUnsignedIntegerFromMemory (lldb::addr_t load_addr,
size_t byte_size,
uint64_t fail_value,
Error &error);
Cleaned up a lot of code that was manually doing what the above functions do
to use the functions listed above.
Added the ability to get a scalar value as a buffer that can be written down
to a process (byte swapping the Scalar value if needed):
uint32_t
Scalar::GetAsMemoryData (void *dst,
uint32_t dst_len,
lldb::ByteOrder dst_byte_order,
Error &error) const;
The "dst_len" can be smaller that the size of the scalar and the least
significant bytes will be written. "dst_len" can also be larger and the
most significant bytes will be padded with zeroes.
Centralized the code that adds or removes address bits for callable and opcode
addresses into lldb_private::Target:
lldb::addr_t
Target::GetCallableLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const;
lldb::addr_t
Target::GetOpcodeLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const;
All necessary lldb_private::Address functions now use the target versions so
changes should only need to happen in one place if anything needs updating.
Fixed up a lot of places that were calling :
addr_t
Address::GetLoadAddress(Target*);
to call the Address::GetCallableLoadAddress() or Address::GetOpcodeLoadAddress()
as needed. There were many places in the breakpoint code where things could
go wrong for ARM if these weren't used.
llvm-svn: 131878
2011-05-23 06:46:53 +08:00
|
|
|
return m_address.GetOpcodeLoadAddress(&m_owner.GetTarget());
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2021-06-12 08:00:46 +08:00
|
|
|
const BreakpointOptions &BreakpointLocation::GetOptionsSpecifyingKind(
|
|
|
|
BreakpointOptions::OptionKind kind) const {
|
2019-02-13 14:25:41 +08:00
|
|
|
if (m_options_up && m_options_up->IsOptionSet(kind))
|
2021-06-12 08:00:46 +08:00
|
|
|
return *m_options_up;
|
2019-02-13 14:25:41 +08:00
|
|
|
else
|
|
|
|
return m_owner.GetOptions();
|
2017-08-02 08:16:10 +08:00
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
Address &BreakpointLocation::GetAddress() { return m_address; }
|
|
|
|
|
|
|
|
Breakpoint &BreakpointLocation::GetBreakpoint() { return m_owner; }
|
|
|
|
|
2015-09-16 05:13:50 +08:00
|
|
|
Target &BreakpointLocation::GetTarget() { return m_owner.GetTarget(); }
|
|
|
|
|
2012-02-02 03:05:20 +08:00
|
|
|
bool BreakpointLocation::IsEnabled() const {
|
2012-01-31 06:48:10 +08:00
|
|
|
if (!m_owner.IsEnabled())
|
|
|
|
return false;
|
2019-02-13 14:25:41 +08:00
|
|
|
else if (m_options_up != nullptr)
|
|
|
|
return m_options_up->IsEnabled();
|
2010-06-09 00:52:24 +08:00
|
|
|
else
|
2012-01-31 06:48:10 +08:00
|
|
|
return true;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void BreakpointLocation::SetEnabled(bool enabled) {
|
2021-06-12 08:00:46 +08:00
|
|
|
GetLocationOptions().SetEnabled(enabled);
|
2010-06-09 00:52:24 +08:00
|
|
|
if (enabled) {
|
|
|
|
ResolveBreakpointSite();
|
|
|
|
} else {
|
|
|
|
ClearBreakpointSite();
|
|
|
|
}
|
2012-02-08 13:23:15 +08:00
|
|
|
SendBreakpointLocationChangedEvent(enabled ? eBreakpointEventTypeEnabled
|
|
|
|
: eBreakpointEventTypeDisabled);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2017-08-04 02:13:24 +08:00
|
|
|
bool BreakpointLocation::IsAutoContinue() const {
|
2019-02-13 14:25:41 +08:00
|
|
|
if (m_options_up &&
|
|
|
|
m_options_up->IsOptionSet(BreakpointOptions::eAutoContinue))
|
|
|
|
return m_options_up->IsAutoContinue();
|
2017-08-04 02:13:24 +08:00
|
|
|
else
|
|
|
|
return m_owner.IsAutoContinue();
|
|
|
|
}
|
|
|
|
|
|
|
|
void BreakpointLocation::SetAutoContinue(bool auto_continue) {
|
2021-06-12 08:00:46 +08:00
|
|
|
GetLocationOptions().SetAutoContinue(auto_continue);
|
2017-08-04 02:13:24 +08:00
|
|
|
SendBreakpointLocationChangedEvent(eBreakpointEventTypeAutoContinueChanged);
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
void BreakpointLocation::SetThreadID(lldb::tid_t thread_id) {
|
2010-06-16 10:00:15 +08:00
|
|
|
if (thread_id != LLDB_INVALID_THREAD_ID)
|
2021-06-12 08:00:46 +08:00
|
|
|
GetLocationOptions().SetThreadID(thread_id);
|
2010-06-16 10:00:15 +08:00
|
|
|
else {
|
2018-05-01 00:49:04 +08:00
|
|
|
// If we're resetting this to an invalid thread id, then don't make an
|
|
|
|
// options pointer just to do that.
|
2019-02-13 14:25:41 +08:00
|
|
|
if (m_options_up != nullptr)
|
|
|
|
m_options_up->SetThreadID(thread_id);
|
2010-06-16 10:00:15 +08:00
|
|
|
}
|
2012-02-08 13:23:15 +08:00
|
|
|
SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::tid_t BreakpointLocation::GetThreadID() {
|
2021-06-12 08:00:46 +08:00
|
|
|
const ThreadSpec *thread_spec =
|
2017-08-02 08:16:10 +08:00
|
|
|
GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec)
|
2021-06-12 08:00:46 +08:00
|
|
|
.GetThreadSpecNoCreate();
|
2017-08-02 08:16:10 +08:00
|
|
|
if (thread_spec)
|
|
|
|
return thread_spec->GetTID();
|
2012-02-08 13:23:15 +08:00
|
|
|
else
|
|
|
|
return LLDB_INVALID_THREAD_ID;
|
|
|
|
}
|
|
|
|
|
|
|
|
void BreakpointLocation::SetThreadIndex(uint32_t index) {
|
|
|
|
if (index != 0)
|
2021-06-12 08:00:46 +08:00
|
|
|
GetLocationOptions().GetThreadSpec()->SetIndex(index);
|
2012-02-08 13:23:15 +08:00
|
|
|
else {
|
2018-05-01 00:49:04 +08:00
|
|
|
// If we're resetting this to an invalid thread id, then don't make an
|
|
|
|
// options pointer just to do that.
|
2019-02-13 14:25:41 +08:00
|
|
|
if (m_options_up != nullptr)
|
|
|
|
m_options_up->GetThreadSpec()->SetIndex(index);
|
2012-02-08 13:23:15 +08:00
|
|
|
}
|
|
|
|
SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t BreakpointLocation::GetThreadIndex() const {
|
2021-06-12 08:00:46 +08:00
|
|
|
const ThreadSpec *thread_spec =
|
2017-08-02 08:16:10 +08:00
|
|
|
GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec)
|
2021-06-12 08:00:46 +08:00
|
|
|
.GetThreadSpecNoCreate();
|
2017-08-02 08:16:10 +08:00
|
|
|
if (thread_spec)
|
|
|
|
return thread_spec->GetIndex();
|
2012-02-08 13:23:15 +08:00
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void BreakpointLocation::SetThreadName(const char *thread_name) {
|
2015-10-31 02:50:12 +08:00
|
|
|
if (thread_name != nullptr)
|
2021-06-12 08:00:46 +08:00
|
|
|
GetLocationOptions().GetThreadSpec()->SetName(thread_name);
|
2012-02-08 13:23:15 +08:00
|
|
|
else {
|
2018-05-01 00:49:04 +08:00
|
|
|
// If we're resetting this to an invalid thread id, then don't make an
|
|
|
|
// options pointer just to do that.
|
2019-02-13 14:25:41 +08:00
|
|
|
if (m_options_up != nullptr)
|
|
|
|
m_options_up->GetThreadSpec()->SetName(thread_name);
|
2012-02-08 13:23:15 +08:00
|
|
|
}
|
|
|
|
SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *BreakpointLocation::GetThreadName() const {
|
2021-06-12 08:00:46 +08:00
|
|
|
const ThreadSpec *thread_spec =
|
2017-08-02 08:16:10 +08:00
|
|
|
GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec)
|
2021-06-12 08:00:46 +08:00
|
|
|
.GetThreadSpecNoCreate();
|
2017-08-02 08:16:10 +08:00
|
|
|
if (thread_spec)
|
|
|
|
return thread_spec->GetName();
|
2012-02-08 13:23:15 +08:00
|
|
|
else
|
2015-10-31 02:50:12 +08:00
|
|
|
return nullptr;
|
2012-02-08 13:23:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void BreakpointLocation::SetQueueName(const char *queue_name) {
|
2015-10-31 02:50:12 +08:00
|
|
|
if (queue_name != nullptr)
|
2021-06-12 08:00:46 +08:00
|
|
|
GetLocationOptions().GetThreadSpec()->SetQueueName(queue_name);
|
2012-02-08 13:23:15 +08:00
|
|
|
else {
|
2018-05-01 00:49:04 +08:00
|
|
|
// If we're resetting this to an invalid thread id, then don't make an
|
|
|
|
// options pointer just to do that.
|
2019-02-13 14:25:41 +08:00
|
|
|
if (m_options_up != nullptr)
|
|
|
|
m_options_up->GetThreadSpec()->SetQueueName(queue_name);
|
2012-02-08 13:23:15 +08:00
|
|
|
}
|
|
|
|
SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *BreakpointLocation::GetQueueName() const {
|
2021-06-12 08:00:46 +08:00
|
|
|
const ThreadSpec *thread_spec =
|
2017-08-02 08:16:10 +08:00
|
|
|
GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec)
|
2021-06-12 08:00:46 +08:00
|
|
|
.GetThreadSpecNoCreate();
|
2017-08-02 08:16:10 +08:00
|
|
|
if (thread_spec)
|
|
|
|
return thread_spec->GetQueueName();
|
2012-02-08 13:23:15 +08:00
|
|
|
else
|
2015-10-31 02:50:12 +08:00
|
|
|
return nullptr;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool BreakpointLocation::InvokeCallback(StoppointCallbackContext *context) {
|
2019-02-13 14:25:41 +08:00
|
|
|
if (m_options_up != nullptr && m_options_up->HasCallback())
|
|
|
|
return m_options_up->InvokeCallback(context, m_owner.GetID(), GetID());
|
2010-06-18 09:00:58 +08:00
|
|
|
else
|
|
|
|
return m_owner.InvokeCallback(context, GetID());
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2021-03-23 09:41:12 +08:00
|
|
|
bool BreakpointLocation::IsCallbackSynchronous() {
|
|
|
|
if (m_options_up != nullptr && m_options_up->HasCallback())
|
|
|
|
return m_options_up->IsCallbackSynchronous();
|
|
|
|
else
|
2021-06-12 08:00:46 +08:00
|
|
|
return m_owner.GetOptions().IsCallbackSynchronous();
|
2021-03-23 09:41:12 +08:00
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
void BreakpointLocation::SetCallback(BreakpointHitCallback callback,
|
|
|
|
void *baton, bool is_synchronous) {
|
2018-05-01 00:49:04 +08:00
|
|
|
// The default "Baton" class will keep a copy of "baton" and won't free or
|
|
|
|
// delete it when it goes goes out of scope.
|
2021-06-12 08:00:46 +08:00
|
|
|
GetLocationOptions().SetCallback(
|
2016-09-14 01:53:38 +08:00
|
|
|
callback, std::make_shared<UntypedBaton>(baton), is_synchronous);
|
2012-02-08 13:23:15 +08:00
|
|
|
SendBreakpointLocationChangedEvent(eBreakpointEventTypeCommandChanged);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void BreakpointLocation::SetCallback(BreakpointHitCallback callback,
|
|
|
|
const BatonSP &baton_sp,
|
|
|
|
bool is_synchronous) {
|
2021-06-12 08:00:46 +08:00
|
|
|
GetLocationOptions().SetCallback(callback, baton_sp, is_synchronous);
|
2012-02-08 13:23:15 +08:00
|
|
|
SendBreakpointLocationChangedEvent(eBreakpointEventTypeCommandChanged);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void BreakpointLocation::ClearCallback() {
|
2021-06-12 08:00:46 +08:00
|
|
|
GetLocationOptions().ClearCallback();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-10-15 07:45:03 +08:00
|
|
|
void BreakpointLocation::SetCondition(const char *condition) {
|
2021-06-12 08:00:46 +08:00
|
|
|
GetLocationOptions().SetCondition(condition);
|
2012-02-08 13:23:15 +08:00
|
|
|
SendBreakpointLocationChangedEvent(eBreakpointEventTypeConditionChanged);
|
2010-10-15 07:45:03 +08:00
|
|
|
}
|
|
|
|
|
2013-04-19 15:09:15 +08:00
|
|
|
const char *BreakpointLocation::GetConditionText(size_t *hash) const {
|
2017-08-02 08:16:10 +08:00
|
|
|
return GetOptionsSpecifyingKind(BreakpointOptions::eCondition)
|
2021-06-12 08:00:46 +08:00
|
|
|
.GetConditionText(hash);
|
2013-04-19 15:09:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool BreakpointLocation::ConditionSaysStop(ExecutionContext &exe_ctx,
|
2017-05-12 12:51:55 +08:00
|
|
|
Status &error) {
|
2013-04-19 15:09:15 +08:00
|
|
|
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-05-19 13:13:57 +08:00
|
|
|
std::lock_guard<std::mutex> guard(m_condition_mutex);
|
|
|
|
|
|
|
|
size_t condition_hash;
|
|
|
|
const char *condition_text = GetConditionText(&condition_hash);
|
|
|
|
|
2013-04-19 15:09:15 +08:00
|
|
|
if (!condition_text) {
|
|
|
|
m_user_expression_sp.reset();
|
|
|
|
return false;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2013-04-19 15:09:15 +08:00
|
|
|
error.Clear();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-04-19 15:09:15 +08:00
|
|
|
DiagnosticManager diagnostics;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-04-19 15:09:15 +08:00
|
|
|
if (condition_hash != m_condition_hash || !m_user_expression_sp ||
|
|
|
|
!m_user_expression_sp->MatchesContext(exe_ctx)) {
|
2015-09-16 05:13:50 +08:00
|
|
|
LanguageType language = eLanguageTypeUnknown;
|
2013-04-19 15:09:15 +08:00
|
|
|
// See if we can figure out the language from the frame, otherwise use the
|
2015-09-16 05:13:50 +08:00
|
|
|
// default language:
|
2013-04-19 15:09:15 +08:00
|
|
|
CompileUnit *comp_unit = m_address.CalculateSymbolContextCompileUnit();
|
|
|
|
if (comp_unit)
|
2015-09-16 05:13:50 +08:00
|
|
|
language = comp_unit->GetLanguage();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-09-16 05:13:50 +08:00
|
|
|
m_user_expression_sp.reset(GetTarget().GetUserExpressionForLanguage(
|
2016-11-08 12:52:16 +08:00
|
|
|
condition_text, llvm::StringRef(), language, Expression::eResultTypeAny,
|
2019-02-05 17:14:36 +08:00
|
|
|
EvaluateExpressionOptions(), nullptr, error));
|
2013-05-11 05:58:45 +08:00
|
|
|
if (error.Fail()) {
|
2019-07-25 01:56:10 +08:00
|
|
|
LLDB_LOGF(log, "Error getting condition expression: %s.",
|
|
|
|
error.AsCString());
|
2013-05-11 05:58:45 +08:00
|
|
|
m_user_expression_sp.reset();
|
2013-04-19 15:09:15 +08:00
|
|
|
return true;
|
2013-05-11 05:58:45 +08:00
|
|
|
}
|
2016-03-19 08:03:59 +08:00
|
|
|
|
|
|
|
if (!m_user_expression_sp->Parse(diagnostics, exe_ctx,
|
2015-09-16 05:13:50 +08:00
|
|
|
eExecutionPolicyOnlyWhenNeeded, true,
|
|
|
|
false)) {
|
|
|
|
error.SetErrorStringWithFormat(
|
|
|
|
"Couldn't parse conditional expression:\n%s",
|
|
|
|
diagnostics.GetString().c_str());
|
|
|
|
m_user_expression_sp.reset();
|
|
|
|
return true;
|
|
|
|
}
|
2015-10-31 02:50:12 +08:00
|
|
|
|
2016-03-19 08:03:59 +08:00
|
|
|
m_condition_hash = condition_hash;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2016-03-19 08:03:59 +08:00
|
|
|
// We need to make sure the user sees any parse errors in their condition, so
|
2018-05-01 00:49:04 +08:00
|
|
|
// we'll hook the constructor errors up to the debugger's Async I/O.
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-03-19 08:03:59 +08:00
|
|
|
ValueObjectSP result_value_sp;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-03-19 08:03:59 +08:00
|
|
|
EvaluateExpressionOptions options;
|
2013-04-19 15:09:15 +08:00
|
|
|
options.SetUnwindOnError(true);
|
|
|
|
options.SetIgnoreBreakpoints(true);
|
|
|
|
options.SetTryAllThreads(true);
|
|
|
|
options.SetResultIsInternal(
|
|
|
|
true); // Don't generate a user variable for condition expressions.
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
Status expr_error;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-03-19 08:03:59 +08:00
|
|
|
diagnostics.Clear();
|
|
|
|
|
2015-09-05 04:49:51 +08:00
|
|
|
ExpressionVariableSP result_variable_sp;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-04-19 15:09:15 +08:00
|
|
|
ExpressionResults result_code = m_user_expression_sp->Execute(
|
|
|
|
diagnostics, exe_ctx, options, m_user_expression_sp, result_variable_sp);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-04-19 15:09:15 +08:00
|
|
|
bool ret;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-04-19 15:09:15 +08:00
|
|
|
if (result_code == eExpressionCompleted) {
|
2013-05-30 04:22:18 +08:00
|
|
|
if (!result_variable_sp) {
|
2013-04-19 15:09:15 +08:00
|
|
|
error.SetErrorString("Expression did not return a result");
|
2013-06-25 01:58:46 +08:00
|
|
|
return false;
|
2013-04-19 15:09:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
result_value_sp = result_variable_sp->GetValueObject();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-11-05 03:35:17 +08:00
|
|
|
if (result_value_sp) {
|
2016-04-13 01:17:35 +08:00
|
|
|
ret = result_value_sp->IsLogicalTrue(error);
|
2016-09-07 04:57:50 +08:00
|
|
|
if (log) {
|
2016-03-19 08:03:59 +08:00
|
|
|
if (error.Success()) {
|
2019-07-25 01:56:10 +08:00
|
|
|
LLDB_LOGF(log, "Condition successfully evaluated, result is %s.\n",
|
|
|
|
ret ? "true" : "false");
|
2015-10-31 08:02:18 +08:00
|
|
|
} else {
|
|
|
|
error.SetErrorString(
|
|
|
|
"Failed to get an integer result from the expression");
|
|
|
|
ret = false;
|
2013-04-19 15:09:15 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2013-04-19 15:09:15 +08:00
|
|
|
} else {
|
|
|
|
ret = false;
|
|
|
|
error.SetErrorString("Failed to get any result from the expression");
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
} else {
|
2013-04-19 15:09:15 +08:00
|
|
|
ret = false;
|
2016-03-19 08:03:59 +08:00
|
|
|
error.SetErrorStringWithFormat("Couldn't execute expression:\n%s",
|
|
|
|
diagnostics.GetString().c_str());
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2016-03-19 08:03:59 +08:00
|
|
|
|
2013-04-19 15:09:15 +08:00
|
|
|
return ret;
|
2010-10-15 07:45:03 +08:00
|
|
|
}
|
|
|
|
|
2020-07-23 23:41:14 +08:00
|
|
|
uint32_t BreakpointLocation::GetIgnoreCount() const {
|
2017-08-02 08:16:10 +08:00
|
|
|
return GetOptionsSpecifyingKind(BreakpointOptions::eIgnoreCount)
|
2021-06-12 08:00:46 +08:00
|
|
|
.GetIgnoreCount();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-07-10 04:39:50 +08:00
|
|
|
void BreakpointLocation::SetIgnoreCount(uint32_t n) {
|
2021-06-12 08:00:46 +08:00
|
|
|
GetLocationOptions().SetIgnoreCount(n);
|
2012-02-08 13:23:15 +08:00
|
|
|
SendBreakpointLocationChangedEvent(eBreakpointEventTypeIgnoreChanged);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2012-06-27 06:27:55 +08:00
|
|
|
void BreakpointLocation::DecrementIgnoreCount() {
|
2019-02-13 14:25:41 +08:00
|
|
|
if (m_options_up != nullptr) {
|
|
|
|
uint32_t loc_ignore = m_options_up->GetIgnoreCount();
|
2012-06-27 06:27:55 +08:00
|
|
|
if (loc_ignore != 0)
|
2019-02-13 14:25:41 +08:00
|
|
|
m_options_up->SetIgnoreCount(loc_ignore - 1);
|
2012-06-27 06:27:55 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BreakpointLocation::IgnoreCountShouldStop() {
|
2021-06-02 07:14:08 +08:00
|
|
|
uint32_t owner_ignore = GetBreakpoint().GetIgnoreCount();
|
|
|
|
uint32_t loc_ignore = 0;
|
|
|
|
if (m_options_up != nullptr)
|
|
|
|
loc_ignore = m_options_up->GetIgnoreCount();
|
|
|
|
|
|
|
|
if (loc_ignore != 0 || owner_ignore != 0) {
|
|
|
|
m_owner.DecrementIgnoreCount();
|
|
|
|
DecrementIgnoreCount(); // Have to decrement our owners' ignore count,
|
|
|
|
// since it won't get a chance to.
|
|
|
|
return false;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2012-06-27 06:27:55 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-06-12 08:00:46 +08:00
|
|
|
BreakpointOptions &BreakpointLocation::GetLocationOptions() {
|
2018-05-01 00:49:04 +08:00
|
|
|
// If we make the copy we don't copy the callbacks because that is
|
|
|
|
// potentially expensive and we don't want to do that for the simple case
|
|
|
|
// where someone is just disabling the location.
|
2019-02-13 14:25:41 +08:00
|
|
|
if (m_options_up == nullptr)
|
2020-06-25 08:44:33 +08:00
|
|
|
m_options_up = std::make_unique<BreakpointOptions>(false);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2021-06-12 08:00:46 +08:00
|
|
|
return *m_options_up;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2021-06-12 08:00:46 +08:00
|
|
|
bool BreakpointLocation::ValidForThisThread(Thread &thread) {
|
|
|
|
return thread.MatchesSpec(
|
|
|
|
GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec)
|
|
|
|
.GetThreadSpecNoCreate());
|
2010-06-16 10:00:15 +08:00
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
// RETURNS - true if we should stop at this breakpoint, false if we
|
2010-06-16 10:00:15 +08:00
|
|
|
// should continue. Note, we don't check the thread spec for the breakpoint
|
|
|
|
// here, since if the breakpoint is not for this thread, then the event won't
|
|
|
|
// even get reported, so the check is redundant.
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
bool BreakpointLocation::ShouldStop(StoppointCallbackContext *context) {
|
|
|
|
bool should_stop = true;
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2014-10-22 09:54:17 +08:00
|
|
|
// Do this first, if a location is disabled, it shouldn't increment its hit
|
|
|
|
// count.
|
2010-06-09 00:52:24 +08:00
|
|
|
if (!IsEnabled())
|
|
|
|
return false;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2010-10-15 07:45:03 +08:00
|
|
|
// We only run synchronous callbacks in ShouldStop:
|
2010-06-09 00:52:24 +08:00
|
|
|
context->is_synchronous = true;
|
|
|
|
should_stop = InvokeCallback(context);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-06-03 07:58:26 +08:00
|
|
|
if (log) {
|
|
|
|
StreamString s;
|
|
|
|
GetDescription(&s, lldb::eDescriptionLevelVerbose);
|
2019-07-25 01:56:10 +08:00
|
|
|
LLDB_LOGF(log, "Hit breakpoint location: %s, %s.\n", s.GetData(),
|
|
|
|
should_stop ? "stopping" : "continuing");
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-01-15 09:41:04 +08:00
|
|
|
return should_stop;
|
|
|
|
}
|
|
|
|
|
|
|
|
void BreakpointLocation::BumpHitCount() {
|
|
|
|
if (IsEnabled()) {
|
|
|
|
// Step our hit count, and also step the hit count of the owner.
|
2020-07-23 23:41:14 +08:00
|
|
|
m_hit_counter.Increment();
|
|
|
|
m_owner.m_hit_counter.Increment();
|
2015-01-15 09:41:04 +08:00
|
|
|
}
|
2014-10-22 09:54:17 +08:00
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
void BreakpointLocation::UndoBumpHitCount() {
|
|
|
|
if (IsEnabled()) {
|
|
|
|
// Step our hit count, and also step the hit count of the owner.
|
2020-07-23 23:41:14 +08:00
|
|
|
m_hit_counter.Decrement();
|
|
|
|
m_owner.m_hit_counter.Decrement();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-10-15 07:45:03 +08:00
|
|
|
bool BreakpointLocation::IsResolved() const {
|
|
|
|
return m_bp_site_sp.get() != nullptr;
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
lldb::BreakpointSiteSP BreakpointLocation::GetBreakpointSite() const {
|
|
|
|
return m_bp_site_sp;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2010-09-15 07:36:40 +08:00
|
|
|
bool BreakpointLocation::ResolveBreakpointSite() {
|
2015-10-31 02:50:12 +08:00
|
|
|
if (m_bp_site_sp)
|
2010-06-09 00:52:24 +08:00
|
|
|
return true;
|
|
|
|
|
2013-10-12 03:48:25 +08:00
|
|
|
Process *process = m_owner.GetTarget().GetProcessSP().get();
|
|
|
|
if (process == nullptr)
|
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2010-07-17 08:56:13 +08:00
|
|
|
lldb::break_id_t new_id =
|
2012-11-30 05:49:15 +08:00
|
|
|
process->CreateBreakpointSite(shared_from_this(), m_owner.IsHardware());
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2013-10-12 03:48:25 +08:00
|
|
|
if (new_id == LLDB_INVALID_BREAK_ID) {
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS);
|
2016-09-07 04:57:50 +08:00
|
|
|
if (log)
|
2019-01-26 02:27:09 +08:00
|
|
|
log->Warning("Failed to add breakpoint site at 0x%" PRIx64,
|
Added new lldb_private::Process memory read/write functions to stop a bunch
of duplicated code from appearing all over LLDB:
lldb::addr_t
Process::ReadPointerFromMemory (lldb::addr_t vm_addr, Error &error);
bool
Process::WritePointerToMemory (lldb::addr_t vm_addr, lldb::addr_t ptr_value, Error &error);
size_t
Process::ReadScalarIntegerFromMemory (lldb::addr_t addr, uint32_t byte_size, bool is_signed, Scalar &scalar, Error &error);
size_t
Process::WriteScalarToMemory (lldb::addr_t vm_addr, const Scalar &scalar, uint32_t size, Error &error);
in lldb_private::Process the following functions were renamed:
From:
uint64_t
Process::ReadUnsignedInteger (lldb::addr_t load_addr,
size_t byte_size,
Error &error);
To:
uint64_t
Process::ReadUnsignedIntegerFromMemory (lldb::addr_t load_addr,
size_t byte_size,
uint64_t fail_value,
Error &error);
Cleaned up a lot of code that was manually doing what the above functions do
to use the functions listed above.
Added the ability to get a scalar value as a buffer that can be written down
to a process (byte swapping the Scalar value if needed):
uint32_t
Scalar::GetAsMemoryData (void *dst,
uint32_t dst_len,
lldb::ByteOrder dst_byte_order,
Error &error) const;
The "dst_len" can be smaller that the size of the scalar and the least
significant bytes will be written. "dst_len" can also be larger and the
most significant bytes will be padded with zeroes.
Centralized the code that adds or removes address bits for callable and opcode
addresses into lldb_private::Target:
lldb::addr_t
Target::GetCallableLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const;
lldb::addr_t
Target::GetOpcodeLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const;
All necessary lldb_private::Address functions now use the target versions so
changes should only need to happen in one place if anything needs updating.
Fixed up a lot of places that were calling :
addr_t
Address::GetLoadAddress(Target*);
to call the Address::GetCallableLoadAddress() or Address::GetOpcodeLoadAddress()
as needed. There were many places in the breakpoint code where things could
go wrong for ARM if these weren't used.
llvm-svn: 131878
2011-05-23 06:46:53 +08:00
|
|
|
m_address.GetOpcodeLoadAddress(&m_owner.GetTarget()));
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2019-01-26 02:27:09 +08:00
|
|
|
return IsResolved();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool BreakpointLocation::SetBreakpointSite(BreakpointSiteSP &bp_site_sp) {
|
|
|
|
m_bp_site_sp = bp_site_sp;
|
2014-03-13 06:03:13 +08:00
|
|
|
SendBreakpointLocationChangedEvent(eBreakpointEventTypeLocationsResolved);
|
2010-06-09 00:52:24 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BreakpointLocation::ClearBreakpointSite() {
|
2012-09-22 08:04:04 +08:00
|
|
|
if (m_bp_site_sp.get()) {
|
|
|
|
ProcessSP process_sp(m_owner.GetTarget().GetProcessSP());
|
2015-02-14 07:24:21 +08:00
|
|
|
// If the process exists, get it to remove the owner, it will remove the
|
2018-05-01 00:49:04 +08:00
|
|
|
// physical implementation of the breakpoint as well if there are no more
|
|
|
|
// owners. Otherwise just remove this owner.
|
2015-10-31 02:50:12 +08:00
|
|
|
if (process_sp)
|
2015-07-09 06:32:23 +08:00
|
|
|
process_sp->RemoveOwnerFromBreakpointSite(GetBreakpoint().GetID(),
|
2010-09-03 05:44:10 +08:00
|
|
|
GetID(), m_bp_site_sp);
|
2014-01-11 07:46:59 +08:00
|
|
|
else
|
2015-07-09 06:32:23 +08:00
|
|
|
m_bp_site_sp->RemoveOwner(GetBreakpoint().GetID(), GetID());
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
m_bp_site_sp.reset();
|
|
|
|
return true;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
return false;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
void BreakpointLocation::GetDescription(Stream *s,
|
2012-09-22 08:04:04 +08:00
|
|
|
lldb::DescriptionLevel level) {
|
2010-06-09 00:52:24 +08:00
|
|
|
SymbolContext sc;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-09-22 08:04:04 +08:00
|
|
|
// If the description level is "initial" then the breakpoint is printing out
|
2018-05-01 00:49:04 +08:00
|
|
|
// our initial state, and we should let it decide how it wants to print our
|
|
|
|
// label.
|
2012-09-22 08:04:04 +08:00
|
|
|
if (level != eDescriptionLevelInitial) {
|
|
|
|
s->Indent();
|
|
|
|
BreakpointID::GetCanonicalReference(s, m_owner.GetID(), GetID());
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
if (level == lldb::eDescriptionLevelBrief)
|
2016-09-07 04:57:50 +08:00
|
|
|
return;
|
|
|
|
|
2012-09-22 08:04:04 +08:00
|
|
|
if (level != eDescriptionLevelInitial)
|
|
|
|
s->PutCString(": ");
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
if (level == lldb::eDescriptionLevelVerbose)
|
|
|
|
s->IndentMore();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
if (m_address.IsSectionOffset()) {
|
|
|
|
m_address.CalculateSymbolContext(&sc);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-09-22 08:04:04 +08:00
|
|
|
if (level == lldb::eDescriptionLevelFull ||
|
|
|
|
level == eDescriptionLevelInitial) {
|
2014-01-11 07:46:59 +08:00
|
|
|
if (IsReExported())
|
|
|
|
s->PutCString("re-exported target = ");
|
2016-09-07 04:57:50 +08:00
|
|
|
else
|
2014-01-11 07:46:59 +08:00
|
|
|
s->PutCString("where = ");
|
2015-02-14 07:24:21 +08:00
|
|
|
sc.DumpStopContext(s, m_owner.GetTarget().GetProcessSP().get(), m_address,
|
|
|
|
false, true, false, true, true);
|
2016-09-07 04:57:50 +08:00
|
|
|
} else {
|
2010-06-09 00:52:24 +08:00
|
|
|
if (sc.module_sp) {
|
|
|
|
s->EOL();
|
2012-09-22 08:04:04 +08:00
|
|
|
s->Indent("module = ");
|
2019-12-06 15:38:23 +08:00
|
|
|
sc.module_sp->GetFileSpec().Dump(s->AsRawOstream());
|
2014-01-11 07:46:59 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
if (sc.comp_unit != nullptr) {
|
|
|
|
s->EOL();
|
|
|
|
s->Indent("compile unit = ");
|
2019-11-28 23:22:44 +08:00
|
|
|
sc.comp_unit->GetPrimaryFile().GetFilename().Dump(s);
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2015-10-31 02:50:12 +08:00
|
|
|
if (sc.function != nullptr) {
|
2010-06-09 00:52:24 +08:00
|
|
|
s->EOL();
|
|
|
|
s->Indent("function = ");
|
|
|
|
s->PutCString(sc.function->GetName().AsCString("<unknown>"));
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
if (sc.line_entry.line > 0) {
|
|
|
|
s->EOL();
|
2010-06-18 09:00:58 +08:00
|
|
|
s->Indent("location = ");
|
|
|
|
sc.line_entry.DumpStopContext(s, true);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-09-22 08:04:04 +08:00
|
|
|
} else {
|
2010-06-18 09:00:58 +08:00
|
|
|
// If we don't have a comp unit, see if we have a symbol we can print.
|
2010-06-09 00:52:24 +08:00
|
|
|
if (sc.symbol) {
|
|
|
|
s->EOL();
|
2010-06-18 09:00:58 +08:00
|
|
|
if (IsReExported())
|
|
|
|
s->Indent("re-exported target = ");
|
2016-09-07 04:57:50 +08:00
|
|
|
else
|
2010-06-09 00:52:24 +08:00
|
|
|
s->Indent("symbol = ");
|
2010-06-18 09:00:58 +08:00
|
|
|
s->PutCString(sc.symbol->GetName().AsCString("<unknown>"));
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-31 02:50:12 +08:00
|
|
|
if (level == lldb::eDescriptionLevelVerbose) {
|
2010-06-09 00:52:24 +08:00
|
|
|
s->EOL();
|
2012-11-30 05:49:15 +08:00
|
|
|
s->Indent();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2012-11-30 05:49:15 +08:00
|
|
|
if (m_address.IsSectionOffset() &&
|
|
|
|
(level == eDescriptionLevelFull || level == eDescriptionLevelInitial))
|
|
|
|
s->Printf(", ");
|
|
|
|
s->Printf("address = ");
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2010-06-18 09:00:58 +08:00
|
|
|
ExecutionContextScope *exe_scope = nullptr;
|
|
|
|
Target *target = &m_owner.GetTarget();
|
2012-01-26 08:08:14 +08:00
|
|
|
if (target)
|
|
|
|
exe_scope = target->GetProcessSP().get();
|
2015-10-31 02:50:12 +08:00
|
|
|
if (exe_scope == nullptr)
|
2010-06-09 00:52:24 +08:00
|
|
|
exe_scope = target;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-01-26 08:08:14 +08:00
|
|
|
if (level == eDescriptionLevelInitial)
|
|
|
|
m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress,
|
|
|
|
Address::DumpStyleFileAddress);
|
2016-09-07 04:57:50 +08:00
|
|
|
else
|
2012-09-22 08:04:04 +08:00
|
|
|
m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress,
|
2012-01-26 08:08:14 +08:00
|
|
|
Address::DumpStyleModuleWithFileAddress);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-01-26 08:08:14 +08:00
|
|
|
if (IsIndirect() && m_bp_site_sp) {
|
|
|
|
Address resolved_address;
|
|
|
|
resolved_address.SetLoadAddress(m_bp_site_sp->GetLoadAddress(), target);
|
|
|
|
Symbol *resolved_symbol = resolved_address.CalculateSymbolContextSymbol();
|
2012-02-08 13:23:15 +08:00
|
|
|
if (resolved_symbol) {
|
|
|
|
if (level == eDescriptionLevelFull || level == eDescriptionLevelInitial)
|
|
|
|
s->Printf(", ");
|
|
|
|
else if (level == lldb::eDescriptionLevelVerbose) {
|
|
|
|
s->EOL();
|
|
|
|
s->Indent();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2012-02-08 13:23:15 +08:00
|
|
|
s->Printf("indirect target = %s",
|
|
|
|
resolved_symbol->GetName().GetCString());
|
|
|
|
}
|
|
|
|
}
|
2014-09-11 05:40:47 +08:00
|
|
|
|
2020-07-23 23:41:14 +08:00
|
|
|
bool is_resolved = IsResolved();
|
|
|
|
bool is_hardware = is_resolved && m_bp_site_sp->IsHardware();
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
if (level == lldb::eDescriptionLevelVerbose) {
|
|
|
|
s->EOL();
|
2012-09-22 08:04:04 +08:00
|
|
|
s->Indent();
|
2020-07-23 23:41:14 +08:00
|
|
|
s->Printf("resolved = %s\n", is_resolved ? "true" : "false");
|
2020-01-25 09:16:02 +08:00
|
|
|
s->Indent();
|
2020-07-23 23:41:14 +08:00
|
|
|
s->Printf("hardware = %s\n", is_hardware ? "true" : "false");
|
2012-09-22 08:04:04 +08:00
|
|
|
s->Indent();
|
2010-06-09 00:52:24 +08:00
|
|
|
s->Printf("hit count = %-4u\n", GetHitCount());
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
if (m_options_up) {
|
2012-09-22 08:04:04 +08:00
|
|
|
s->Indent();
|
2019-02-13 14:25:41 +08:00
|
|
|
m_options_up->GetDescription(s, level);
|
2010-06-09 00:52:24 +08:00
|
|
|
s->EOL();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
s->IndentLess();
|
2012-09-22 08:04:04 +08:00
|
|
|
} else if (level != eDescriptionLevelInitial) {
|
2020-07-23 23:41:14 +08:00
|
|
|
s->Printf(", %sresolved, %shit count = %u ", (is_resolved ? "" : "un"),
|
|
|
|
(is_hardware ? "hardware, " : ""), GetHitCount());
|
2019-02-13 14:25:41 +08:00
|
|
|
if (m_options_up) {
|
|
|
|
m_options_up->GetDescription(s, level);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-11 05:40:47 +08:00
|
|
|
void BreakpointLocation::Dump(Stream *s) const {
|
|
|
|
if (s == nullptr)
|
2016-09-07 04:57:50 +08:00
|
|
|
return;
|
|
|
|
|
2020-07-23 23:41:14 +08:00
|
|
|
bool is_resolved = IsResolved();
|
|
|
|
bool is_hardware = is_resolved && m_bp_site_sp->IsHardware();
|
|
|
|
auto hardware_index = is_resolved ?
|
|
|
|
m_bp_site_sp->GetHardwareIndex() : LLDB_INVALID_INDEX32;
|
|
|
|
|
2017-08-02 08:16:10 +08:00
|
|
|
lldb::tid_t tid = GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec)
|
2021-06-12 08:00:46 +08:00
|
|
|
.GetThreadSpecNoCreate()
|
|
|
|
->GetTID();
|
2019-02-12 11:47:39 +08:00
|
|
|
s->Printf("BreakpointLocation %u: tid = %4.4" PRIx64
|
|
|
|
" load addr = 0x%8.8" PRIx64 " state = %s type = %s breakpoint "
|
|
|
|
"hw_index = %i hit_count = %-4u ignore_count = %-4u",
|
|
|
|
GetID(), tid,
|
|
|
|
(uint64_t)m_address.GetOpcodeLoadAddress(&m_owner.GetTarget()),
|
2019-02-13 14:25:41 +08:00
|
|
|
(m_options_up ? m_options_up->IsEnabled() : m_owner.IsEnabled())
|
2019-02-12 11:47:39 +08:00
|
|
|
? "enabled "
|
|
|
|
: "disabled",
|
2021-06-12 08:00:46 +08:00
|
|
|
is_hardware ? "hardware" : "software", hardware_index,
|
|
|
|
GetHitCount(),
|
2019-02-12 11:47:39 +08:00
|
|
|
GetOptionsSpecifyingKind(BreakpointOptions::eIgnoreCount)
|
2021-06-12 08:00:46 +08:00
|
|
|
.GetIgnoreCount());
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
Generate an event when a pending breakpoint binds
Summary:
This checkin sends an MI event when a module is loaded that causes a pending breakpoint to bind to it's real address in the target. This allows breakpoints to be set before the process is launched, and the target address of the BP to be discovered when the module loads, prior to the breakpoint being hit.
Patch from chuckr@microsoft.com
Test Plan:
I ran the check-lldb target with and without this patch and saw no change. I am unsure of how to write an MI specific test for this because the new event is buried in module load events. Here is an example (the new event is in bold):
```
(gdb)
-file-exec-and-symbols a.out
^done
(gdb)
=shlibs-added,shlib-info=[num="1",name="a.out",dyld-addr="-",reason="dyld",path="/Users/chuckr/llama/llvm/tools/lldb/test/tools/lldb-mi/a.out",loaded_addr="-",dsym-objpath="/Users/chuckr/llama/llvm/tools/lldb/test/tools/lldb-mi/a.out.dSYM/Contents/Resources/DWARF/a.out"]
-break-insert -f main.cpp:15
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0xffffffffffffffff",func="main",file="main.cpp",fullname="/Users/chuckr/llama/llvm/tools/lldb/test/tools/lldb-mi/main.cpp",line="15",pending=["main.cpp:15"],times="0",original-location="main.cpp:15"}
(gdb)
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0xffffffffffffffff",func="main",file="main.cpp",fullname="/Users/chuckr/llama/llvm/tools/lldb/test/tools/lldb-mi/main.cpp",line="15",pending=["main.cpp:15"],times="0",original-location="main.cpp:15"}
-exec-run
^running
=thread-group-started,id="i1",pid="75620"
(gdb)
=thread-created,id="1",group-id="i1"
=thread-selected,id="1"
(gdb)
=shlibs-added,shlib-info=[num="2",name="dyld",dyld-addr="0x7fff5fc00000",reason="dyld",path="/usr/lib/dyld",loaded_addr="0x7fff5fc00000"]
(gdb)
=shlibs-added,shlib-info=[num="3",name="dyld",dyld-addr="0x7fff5fc00000",reason="dyld",path="/usr/lib/dyld",loaded_addr="0x7fff5fc00000"]
(gdb)
*running,thread-id="all"
(gdb)
(gdb)
=shlibs-added,shlib-info=[num="4",name="libc++.1.dylib",dyld-addr="0x7fff85dd0000",reason="dyld",path="/usr/lib/libc++.1.dylib",loaded_addr="0x7fff85dd0000"]
(gdb)
=shlibs-added,shlib-info=[num="5",name="libSystem.B.dylib",dyld-addr="0x7fff851ab000",reason="dyld",path="/usr/lib/libSystem.B.dylib",loaded_addr="0x7fff851ab000"]
(gdb)
=shlibs-added,shlib-info=[num="6",name="libc++abi.dylib",dyld-addr="0x7fff81be8000",reason="dyld",path="/usr/lib/libc++abi.dylib",loaded_addr="0x7fff81be8000"]
(gdb)
=shlibs-added,shlib-info=[num="7",name="libcache.dylib",dyld-addr="0x7fff8b975000",reason="dyld",path="/usr/lib/system/libcache.dylib",loaded_addr="0x7fff8b975000"]
(gdb)
=shlibs-added,shlib-info=[num="8",name="libcommonCrypto.dylib",dyld-addr="0x7fff85d14000",reason="dyld",path="/usr/lib/system/libcommonCrypto.dylib",loaded_addr="0x7fff85d14000"]
(gdb)
=shlibs-added,shlib-info=[num="9",name="libcompiler_rt.dylib",dyld-addr="0x7fff86154000",reason="dyld",path="/usr/lib/system/libcompiler_rt.dylib",loaded_addr="0x7fff86154000"]
(gdb)
=shlibs-added,shlib-info=[num="10",name="libcopyfile.dylib",dyld-addr="0x7fff81ac7000",reason="dyld",path="/usr/lib/system/libcopyfile.dylib",loaded_addr="0x7fff81ac7000"]
(gdb)
=shlibs-added,shlib-info=[num="11",name="libcorecrypto.dylib",dyld-addr="0x7fff87d5d000",reason="dyld",path="/usr/lib/system/libcorecrypto.dylib",loaded_addr="0x7fff87d5d000"]
(gdb)
=shlibs-added,shlib-info=[num="12",name="libdispatch.dylib",dyld-addr="0x7fff8ea8c000",reason="dyld",path="/usr/lib/system/libdispatch.dylib",loaded_addr="0x7fff8ea8c000"]
(gdb)
=shlibs-added,shlib-info=[num="13",name="libdyld.dylib",dyld-addr="0x7fff89087000",reason="dyld",path="/usr/lib/system/libdyld.dylib",loaded_addr="0x7fff89087000"]
(gdb)
=shlibs-added,shlib-info=[num="14",name="libkeymgr.dylib",dyld-addr="0x7fff8e818000",reason="dyld",path="/usr/lib/system/libkeymgr.dylib",loaded_addr="0x7fff8e818000"]
(gdb)
=shlibs-added,shlib-info=[num="15",name="liblaunch.dylib",dyld-addr="0x7fff84936000",reason="dyld",path="/usr/lib/system/liblaunch.dylib",loaded_addr="0x7fff84936000"]
(gdb)
=shlibs-added,shlib-info=[num="16",name="libmacho.dylib",dyld-addr="0x7fff8534e000",reason="dyld",path="/usr/lib/system/libmacho.dylib",loaded_addr="0x7fff8534e000"]
(gdb)
=shlibs-added,shlib-info=[num="17",name="libquarantine.dylib",dyld-addr="0x7fff90f97000",reason="dyld",path="/usr/lib/system/libquarantine.dylib",loaded_addr="0x7fff90f97000"]
(gdb)
=shlibs-added,shlib-info=[num="18",name="libremovefile.dylib",dyld-addr="0x7fff8ccb5000",reason="dyld",path="/usr/lib/system/libremovefile.dylib",loaded_addr="0x7fff8ccb5000"]
(gdb)
=shlibs-added,shlib-info=[num="19",name="libsystem_asl.dylib",dyld-addr="0x7fff8df67000",reason="dyld",path="/usr/lib/system/libsystem_asl.dylib",loaded_addr="0x7fff8df67000"]
(gdb)
=shlibs-added,shlib-info=[num="20",name="libsystem_blocks.dylib",dyld-addr="0x7fff8621c000",reason="dyld",path="/usr/lib/system/libsystem_blocks.dylib",loaded_addr="0x7fff8621c000"]
(gdb)
=shlibs-added,shlib-info=[num="21",name="libsystem_c.dylib",dyld-addr="0x7fff83c0f000",reason="dyld",path="/usr/lib/system/libsystem_c.dylib",loaded_addr="0x7fff83c0f000"]
(gdb)
=shlibs-added,shlib-info=[num="22",name="libsystem_configuration.dylib",dyld-addr="0x7fff8fd71000",reason="dyld",path="/usr/lib/system/libsystem_configuration.dylib",loaded_addr="0x7fff8fd71000"]
(gdb)
=shlibs-added,shlib-info=[num="23",name="libsystem_coreservices.dylib",dyld-addr="0x7fff8a028000",reason="dyld",path="/usr/lib/system/libsystem_coreservices.dylib",loaded_addr="0x7fff8a028000"]
(gdb)
=shlibs-added,shlib-info=[num="24",name="libsystem_coretls.dylib",dyld-addr="0x7fff90996000",reason="dyld",path="/usr/lib/system/libsystem_coretls.dylib",loaded_addr="0x7fff90996000"]
(gdb)
=shlibs-added,shlib-info=[num="25",name="libsystem_dnssd.dylib",dyld-addr="0x7fff8b71f000",reason="dyld",path="/usr/lib/system/libsystem_dnssd.dylib",loaded_addr="0x7fff8b71f000"]
(gdb)
=shlibs-added,shlib-info=[num="26",name="libsystem_info.dylib",dyld-addr="0x7fff8b9f2000",reason="dyld",path="/usr/lib/system/libsystem_info.dylib",loaded_addr="0x7fff8b9f2000"]
(gdb)
=shlibs-added,shlib-info=[num="27",name="libsystem_kernel.dylib",dyld-addr="0x7fff81ad0000",reason="dyld",path="/usr/lib/system/libsystem_kernel.dylib",loaded_addr="0x7fff81ad0000"]
(gdb)
=shlibs-added,shlib-info=[num="28",name="libsystem_m.dylib",dyld-addr="0x7fff84953000",reason="dyld",path="/usr/lib/system/libsystem_m.dylib",loaded_addr="0x7fff84953000"]
(gdb)
=shlibs-added,shlib-info=[num="29",name="libsystem_malloc.dylib",dyld-addr="0x7fff887bd000",reason="dyld",path="/usr/lib/system/libsystem_malloc.dylib",loaded_addr="0x7fff887bd000"]
(gdb)
=shlibs-added,shlib-info=[num="30",name="libsystem_network.dylib",dyld-addr="0x7fff88304000",reason="dyld",path="/usr/lib/system/libsystem_network.dylib",loaded_addr="0x7fff88304000"]
(gdb)
=shlibs-added,shlib-info=[num="31",name="libsystem_networkextension.dylib",dyld-addr="0x7fff82085000",reason="dyld",path="/usr/lib/system/libsystem_networkextension.dylib",loaded_addr="0x7fff82085000"]
(gdb)
=shlibs-added,shlib-info=[num="32",name="libsystem_notify.dylib",dyld-addr="0x7fff8eb69000",reason="dyld",path="/usr/lib/system/libsystem_notify.dylib",loaded_addr="0x7fff8eb69000"]
(gdb)
=shlibs-added,shlib-info=[num="33",name="libsystem_platform.dylib",dyld-addr="0x7fff89ac7000",reason="dyld",path="/usr/lib/system/libsystem_platform.dylib",loaded_addr="0x7fff89ac7000"]
(gdb)
=shlibs-added,shlib-info=[num="34",name="libsystem_pthread.dylib",dyld-addr="0x7fff83ff8000",reason="dyld",path="/usr/lib/system/libsystem_pthread.dylib",loaded_addr="0x7fff83ff8000"]
(gdb)
=shlibs-added,shlib-info=[num="35",name="libsystem_sandbox.dylib",dyld-addr="0x7fff89084000",reason="dyld",path="/usr/lib/system/libsystem_sandbox.dylib",loaded_addr="0x7fff89084000"]
(gdb)
=shlibs-added,shlib-info=[num="36",name="libsystem_secinit.dylib",dyld-addr="0x7fff8e816000",reason="dyld",path="/usr/lib/system/libsystem_secinit.dylib",loaded_addr="0x7fff8e816000"]
(gdb)
=shlibs-added,shlib-info=[num="37",name="libsystem_stats.dylib",dyld-addr="0x7fff89eaf000",reason="dyld",path="/usr/lib/system/libsystem_stats.dylib",loaded_addr="0x7fff89eaf000"]
(gdb)
=shlibs-added,shlib-info=[num="38",name="libsystem_trace.dylib",dyld-addr="0x7fff8ead4000",reason="dyld",path="/usr/lib/system/libsystem_trace.dylib",loaded_addr="0x7fff8ead4000"]
(gdb)
=shlibs-added,shlib-info=[num="39",name="libunc.dylib",dyld-addr="0x7fff8ab27000",reason="dyld",path="/usr/lib/system/libunc.dylib",loaded_addr="0x7fff8ab27000"]
(gdb)
=shlibs-added,shlib-info=[num="40",name="libunwind.dylib",dyld-addr="0x7fff85cf3000",reason="dyld",path="/usr/lib/system/libunwind.dylib",loaded_addr="0x7fff85cf3000"]
(gdb)
=shlibs-added,shlib-info=[num="41",name="libxpc.dylib",dyld-addr="0x7fff88896000",reason="dyld",path="/usr/lib/system/libxpc.dylib",loaded_addr="0x7fff88896000"]
(gdb)
=shlibs-added,shlib-info=[num="42",name="libobjc.A.dylib",dyld-addr="0x7fff84f13000",reason="dyld",path="/usr/lib/libobjc.A.dylib",loaded_addr="0x7fff84f13000"]
(gdb)
=shlibs-added,shlib-info=[num="43",name="libauto.dylib",dyld-addr="0x7fff85d89000",reason="dyld",path="/usr/lib/libauto.dylib",loaded_addr="0x7fff85d89000"]
(gdb)
=shlibs-added,shlib-info=[num="44",name="libDiagnosticMessagesClient.dylib",dyld-addr="0x7fff822e1000",reason="dyld",path="/usr/lib/libDiagnosticMessagesClient.dylib",loaded_addr="0x7fff822e1000"]
```
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100000f4d",func="main",file="main.cpp",fullname="/Users/chuckr/llama/llvm/tools/lldb/test/tools/lldb-mi/main.cpp",line="15",pending=["main.cpp:15"],times="0",original-location="main.cpp:15"}
```
(gdb)
=shlibs-added,shlib-info=[num="45",name="a.out",dyld-addr="0x100000000",reason="dyld",path="/Users/chuckr/llama/llvm/tools/lldb/test/tools/lldb-mi/a.out",loaded_addr="0x100000000",dsym-objpath="/Users/chuckr/llama/llvm/tools/lldb/test/tools/lldb-mi/a.out.dSYM/Contents/Resources/DWARF/a.out"]
=shlibs-added,shlib-info=[num="46",name="libc++.1.dylib",dyld-addr="0x7fff85dd0000",reason="dyld",path="/usr/lib/libc++.1.dylib",loaded_addr="0x7fff85dd0000"]
=shlibs-added,shlib-info=[num="47",name="libSystem.B.dylib",dyld-addr="0x7fff851ab000",reason="dyld",path="/usr/lib/libSystem.B.dylib",loaded_addr="0x7fff851ab000"]
=shlibs-added,shlib-info=[num="48",name="libc++abi.dylib",dyld-addr="0x7fff81be8000",reason="dyld",path="/usr/lib/libc++abi.dylib",loaded_addr="0x7fff81be8000"]
=shlibs-added,shlib-info=[num="49",name="libcache.dylib",dyld-addr="0x7fff8b975000",reason="dyld",path="/usr/lib/system/libcache.dylib",loaded_addr="0x7fff8b975000"]
=shlibs-added,shlib-info=[num="50",name="libcommonCrypto.dylib",dyld-addr="0x7fff85d14000",reason="dyld",path="/usr/lib/system/libcommonCrypto.dylib",loaded_addr="0x7fff85d14000"]
=shlibs-added,shlib-info=[num="51",name="libcompiler_rt.dylib",dyld-addr="0x7fff86154000",reason="dyld",path="/usr/lib/system/libcompiler_rt.dylib",loaded_addr="0x7fff86154000"]
=shlibs-added,shlib-info=[num="52",name="libcopyfile.dylib",dyld-addr="0x7fff81ac7000",reason="dyld",path="/usr/lib/system/libcopyfile.dylib",loaded_addr="0x7fff81ac7000"]
=shlibs-added,shlib-info=[num="53",name="libcorecrypto.dylib",dyld-addr="0x7fff87d5d000",reason="dyld",path="/usr/lib/system/libcorecrypto.dylib",loaded_addr="0x7fff87d5d000"]
=shlibs-added,shlib-info=[num="54",name="libdispatch.dylib",dyld-addr="0x7fff8ea8c000",reason="dyld",path="/usr/lib/system/libdispatch.dylib",loaded_addr="0x7fff8ea8c000"]
=shlibs-added,shlib-info=[num="55",name="libdyld.dylib",dyld-addr="0x7fff89087000",reason="dyld",path="/usr/lib/system/libdyld.dylib",loaded_addr="0x7fff89087000"]
=shlibs-added,shlib-info=[num="56",name="libkeymgr.dylib",dyld-addr="0x7fff8e818000",reason="dyld",path="/usr/lib/system/libkeymgr.dylib",loaded_addr="0x7fff8e818000"]
=shlibs-added,shlib-info=[num="57",name="liblaunch.dylib",dyld-addr="0x7fff84936000",reason="dyld",path="/usr/lib/system/liblaunch.dylib",loaded_addr="0x7fff84936000"]
=shlibs-added,shlib-info=[num="58",name="libmacho.dylib",dyld-addr="0x7fff8534e000",reason="dyld",path="/usr/lib/system/libmacho.dylib",loaded_addr="0x7fff8534e000"]
=shlibs-added,shlib-info=[num="59",name="libquarantine.dylib",dyld-addr="0x7fff90f97000",reason="dyld",path="/usr/lib/system/libquarantine.dylib",loaded_addr="0x7fff90f97000"]
=shlibs-added,shlib-info=[num="60",name="libremovefile.dylib",dyld-addr="0x7fff8ccb5000",reason="dyld",path="/usr/lib/system/libremovefile.dylib",loaded_addr="0x7fff8ccb5000"]
=shlibs-added,shlib-info=[num="61",name="libsystem_asl.dylib",dyld-addr="0x7fff8df67000",reason="dyld",path="/usr/lib/system/libsystem_asl.dylib",loaded_addr="0x7fff8df67000"]
=shlibs-added,shlib-info=[num="62",name="libsystem_blocks.dylib",dyld-addr="0x7fff8621c000",reason="dyld",path="/usr/lib/system/libsystem_blocks.dylib",loaded_addr="0x7fff8621c000"]
=shlibs-added,shlib-info=[num="63",name="libsystem_c.dylib",dyld-addr="0x7fff83c0f000",reason="dyld",path="/usr/lib/system/libsystem_c.dylib",loaded_addr="0x7fff83c0f000"]
=shlibs-added,shlib-info=[num="64",name="libsystem_configuration.dylib",dyld-addr="0x7fff8fd71000",reason="dyld",path="/usr/lib/system/libsystem_configuration.dylib",loaded_addr="0x7fff8fd71000"]
=shlibs-added,shlib-info=[num="65",name="libsystem_coreservices.dylib",dyld-addr="0x7fff8a028000",reason="dyld",path="/usr/lib/system/libsystem_coreservices.dylib",loaded_addr="0x7fff8a028000"]
=shlibs-added,shlib-info=[num="66",name="libsystem_coretls.dylib",dyld-addr="0x7fff90996000",reason="dyld",path="/usr/lib/system/libsystem_coretls.dylib",loaded_addr="0x7fff90996000"]
=shlibs-added,shlib-info=[num="67",name="libsystem_dnssd.dylib",dyld-addr="0x7fff8b71f000",reason="dyld",path="/usr/lib/system/libsystem_dnssd.dylib",loaded_addr="0x7fff8b71f000"]
=shlibs-added,shlib-info=[num="68",name="libsystem_info.dylib",dyld-addr="0x7fff8b9f2000",reason="dyld",path="/usr/lib/system/libsystem_info.dylib",loaded_addr="0x7fff8b9f2000"]
=shlibs-added,shlib-info=[num="69",name="libsystem_kernel.dylib",dyld-addr="0x7fff81ad0000",reason="dyld",path="/usr/lib/system/libsystem_kernel.dylib",loaded_addr="0x7fff81ad0000"]
=shlibs-added,shlib-info=[num="70",name="libsystem_m.dylib",dyld-addr="0x7fff84953000",reason="dyld",path="/usr/lib/system/libsystem_m.dylib",loaded_addr="0x7fff84953000"]
=shlibs-added,shlib-info=[num="71",name="libsystem_malloc.dylib",dyld-addr="0x7fff887bd000",reason="dyld",path="/usr/lib/system/libsystem_malloc.dylib",loaded_addr="0x7fff887bd000"]
=shlibs-added,shlib-info=[num="72",name="libsystem_network.dylib",dyld-addr="0x7fff88304000",reason="dyld",path="/usr/lib/system/libsystem_network.dylib",loaded_addr="0x7fff88304000"]
=shlibs-added,shlib-info=[num="73",name="libsystem_networkextension.dylib",dyld-addr="0x7fff82085000",reason="dyld",path="/usr/lib/system/libsystem_networkextension.dylib",loaded_addr="0x7fff82085000"]
=shlibs-added,shlib-info=[num="74",name="libsystem_notify.dylib",dyld-addr="0x7fff8eb69000",reason="dyld",path="/usr/lib/system/libsystem_notify.dylib",loaded_addr="0x7fff8eb69000"]
=shlibs-added,shlib-info=[num="75",name="libsystem_platform.dylib",dyld-addr="0x7fff89ac7000",reason="dyld",path="/usr/lib/system/libsystem_platform.dylib",loaded_addr="0x7fff89ac7000"]
=shlibs-added,shlib-info=[num="76",name="libsystem_pthread.dylib",dyld-addr="0x7fff83ff8000",reason="dyld",path="/usr/lib/system/libsystem_pthread.dylib",loaded_addr="0x7fff83ff8000"]
=shlibs-added,shlib-info=[num="77",name="libsystem_sandbox.dylib",dyld-addr="0x7fff89084000",reason="dyld",path="/usr/lib/system/libsystem_sandbox.dylib",loaded_addr="0x7fff89084000"]
=shlibs-added,shlib-info=[num="78",name="libsystem_secinit.dylib",dyld-addr="0x7fff8e816000",reason="dyld",path="/usr/lib/system/libsystem_secinit.dylib",loaded_addr="0x7fff8e816000"]
=shlibs-added,shlib-info=[num="79",name="libsystem_stats.dylib",dyld-addr="0x7fff89eaf000",reason="dyld",path="/usr/lib/system/libsystem_stats.dylib",loaded_addr="0x7fff89eaf000"]
=shlibs-added,shlib-info=[num="80",name="libsystem_trace.dylib",dyld-addr="0x7fff8ead4000",reason="dyld",path="/usr/lib/system/libsystem_trace.dylib",loaded_addr="0x7fff8ead4000"]
=shlibs-added,shlib-info=[num="81",name="libunc.dylib",dyld-addr="0x7fff8ab27000",reason="dyld",path="/usr/lib/system/libunc.dylib",loaded_addr="0x7fff8ab27000"]
=shlibs-added,shlib-info=[num="82",name="libunwind.dylib",dyld-addr="0x7fff85cf3000",reason="dyld",path="/usr/lib/system/libunwind.dylib",loaded_addr="0x7fff85cf3000"]
=shlibs-added,shlib-info=[num="83",name="libxpc.dylib",dyld-addr="0x7fff88896000",reason="dyld",path="/usr/lib/system/libxpc.dylib",loaded_addr="0x7fff88896000"]
=shlibs-added,shlib-info=[num="84",name="libobjc.A.dylib",dyld-addr="0x7fff84f13000",reason="dyld",path="/usr/lib/libobjc.A.dylib",loaded_addr="0x7fff84f13000"]
=shlibs-added,shlib-info=[num="85",name="libauto.dylib",dyld-addr="0x7fff85d89000",reason="dyld",path="/usr/lib/libauto.dylib",loaded_addr="0x7fff85d89000"]
=shlibs-added,shlib-info=[num="86",name="libDiagnosticMessagesClient.dylib",dyld-addr="0x7fff822e1000",reason="dyld",path="/usr/lib/libDiagnosticMessagesClient.dylib",loaded_addr="0x7fff822e1000"]
(gdb)
*stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x0000000100000f4d",func="main",args=[{name="argc",value="1"},{name="argv",value="0x00007fff5fbffed8"}],file="main.cpp",fullname="/Users/chuckr/llama/llvm/tools/lldb/test/tools/lldb-mi/main.cpp",line="15"},thread-id="1",stopped-threads="all"
(gdb)
```
Reviewers: abidh, clayborg, ChuckR, jingham
Subscribers: ki.stfu, paulmaybee, lldb-commits
Differential Revision: http://reviews.llvm.org/D8847
llvm-svn: 234483
2015-04-09 20:55:13 +08:00
|
|
|
void BreakpointLocation::SendBreakpointLocationChangedEvent(
|
|
|
|
lldb::BreakpointEventType eventKind) {
|
2012-02-08 13:23:15 +08:00
|
|
|
if (!m_being_created && !m_owner.IsInternal() &&
|
|
|
|
m_owner.GetTarget().EventTypeHasListeners(
|
|
|
|
Target::eBroadcastBitBreakpointChanged)) {
|
|
|
|
Breakpoint::BreakpointEventData *data = new Breakpoint::BreakpointEventData(
|
|
|
|
eventKind, m_owner.shared_from_this());
|
|
|
|
data->GetBreakpointLocationCollection().Add(shared_from_this());
|
|
|
|
m_owner.GetTarget().BroadcastEvent(Target::eBroadcastBitBreakpointChanged,
|
2016-09-07 04:57:50 +08:00
|
|
|
data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-11 05:40:47 +08:00
|
|
|
void BreakpointLocation::SwapLocation(BreakpointLocationSP swap_from) {
|
|
|
|
m_address = swap_from->m_address;
|
|
|
|
m_should_resolve_indirect_functions =
|
|
|
|
swap_from->m_should_resolve_indirect_functions;
|
|
|
|
m_is_reexported = swap_from->m_is_reexported;
|
|
|
|
m_is_indirect = swap_from->m_is_indirect;
|
|
|
|
m_user_expression_sp.reset();
|
|
|
|
}
|