2010-09-23 10:01:19 +08:00
|
|
|
//===-- ItaniumABILanguageRuntime.cpp --------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "ItaniumABILanguageRuntime.h"
|
|
|
|
|
2010-11-04 06:19:38 +08:00
|
|
|
#include "lldb/Breakpoint/BreakpointLocation.h"
|
2010-09-23 10:01:19 +08:00
|
|
|
#include "lldb/Core/ConstString.h"
|
|
|
|
#include "lldb/Core/Error.h"
|
2012-03-29 01:13:26 +08:00
|
|
|
#include "lldb/Core/Log.h"
|
2010-09-23 10:01:19 +08:00
|
|
|
#include "lldb/Core/Module.h"
|
|
|
|
#include "lldb/Core/PluginManager.h"
|
|
|
|
#include "lldb/Core/Scalar.h"
|
2011-04-16 08:01:13 +08:00
|
|
|
#include "lldb/Core/ValueObject.h"
|
|
|
|
#include "lldb/Core/ValueObjectMemory.h"
|
2010-09-23 10:01:19 +08:00
|
|
|
#include "lldb/Symbol/ClangASTContext.h"
|
|
|
|
#include "lldb/Target/Process.h"
|
|
|
|
#include "lldb/Target/RegisterContext.h"
|
2010-11-04 06:19:38 +08:00
|
|
|
#include "lldb/Target/StopInfo.h"
|
2010-09-23 10:01:19 +08:00
|
|
|
#include "lldb/Target/Target.h"
|
|
|
|
#include "lldb/Target/Thread.h"
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
static const char *pluginName = "ItaniumABILanguageRuntime";
|
|
|
|
static const char *pluginDesc = "Itanium ABI for the C++ language";
|
|
|
|
static const char *pluginShort = "language.itanium";
|
2011-04-16 08:01:13 +08:00
|
|
|
static const char *vtable_demangled_prefix = "vtable for ";
|
2010-09-23 10:01:19 +08:00
|
|
|
|
2011-04-16 08:01:13 +08:00
|
|
|
bool
|
|
|
|
ItaniumABILanguageRuntime::CouldHaveDynamicValue (ValueObject &in_value)
|
|
|
|
{
|
2011-05-30 08:49:24 +08:00
|
|
|
return in_value.IsPossibleCPlusPlusDynamicType();
|
2011-04-16 08:01:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2011-05-04 11:43:18 +08:00
|
|
|
ItaniumABILanguageRuntime::GetDynamicTypeAndAddress (ValueObject &in_value,
|
|
|
|
lldb::DynamicValueType use_dynamic,
|
|
|
|
TypeAndOrName &class_type_or_name,
|
|
|
|
Address &dynamic_address)
|
2010-09-28 09:25:32 +08:00
|
|
|
{
|
2011-04-16 08:01:13 +08:00
|
|
|
// For Itanium, if the type has a vtable pointer in the object, it will be at offset 0
|
|
|
|
// in the object. That will point to the "address point" within the vtable (not the beginning of the
|
|
|
|
// vtable.) We can then look up the symbol containing this "address point" and that symbol's name
|
|
|
|
// demangled will contain the full class name.
|
|
|
|
// The second pointer above the "address point" is the "offset_to_top". We'll use that to get the
|
|
|
|
// start of the value object which holds the dynamic type.
|
|
|
|
//
|
|
|
|
|
|
|
|
// Only a pointer or reference type can have a different dynamic and static type:
|
|
|
|
if (CouldHaveDynamicValue (in_value))
|
|
|
|
{
|
|
|
|
// First job, pull out the address at 0 offset from the object.
|
|
|
|
AddressType address_type;
|
Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types
llvm-svn: 139160
2011-09-07 03:20:51 +08:00
|
|
|
lldb::addr_t original_ptr = in_value.GetPointerValue(&address_type);
|
2011-04-16 08:01:13 +08:00
|
|
|
if (original_ptr == LLDB_INVALID_ADDRESS)
|
|
|
|
return false;
|
2012-02-17 15:49:44 +08:00
|
|
|
|
|
|
|
ExecutionContext exe_ctx (in_value.GetExecutionContextRef());
|
|
|
|
|
|
|
|
Target *target = exe_ctx.GetTargetPtr();
|
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
2011-04-16 08:01:13 +08:00
|
|
|
|
|
|
|
char memory_buffer[16];
|
|
|
|
DataExtractor data(memory_buffer, sizeof(memory_buffer),
|
|
|
|
process->GetByteOrder(),
|
|
|
|
process->GetAddressByteSize());
|
|
|
|
size_t address_byte_size = process->GetAddressByteSize();
|
|
|
|
Error error;
|
|
|
|
size_t bytes_read = process->ReadMemory (original_ptr,
|
|
|
|
memory_buffer,
|
|
|
|
address_byte_size,
|
|
|
|
error);
|
|
|
|
if (!error.Success() || (bytes_read != address_byte_size))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t offset_ptr = 0;
|
|
|
|
lldb::addr_t vtable_address_point = data.GetAddress (&offset_ptr);
|
|
|
|
|
|
|
|
if (offset_ptr == 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// Now find the symbol that contains this address:
|
|
|
|
|
|
|
|
SymbolContext sc;
|
|
|
|
Address address_point_address;
|
|
|
|
if (target && !target->GetSectionLoadList().IsEmpty())
|
|
|
|
{
|
|
|
|
if (target->GetSectionLoadList().ResolveLoadAddress (vtable_address_point, address_point_address))
|
|
|
|
{
|
|
|
|
target->GetImages().ResolveSymbolContextForAddress (address_point_address, eSymbolContextSymbol, sc);
|
|
|
|
Symbol *symbol = sc.symbol;
|
|
|
|
if (symbol != NULL)
|
|
|
|
{
|
|
|
|
const char *name = symbol->GetMangled().GetDemangledName().AsCString();
|
|
|
|
if (strstr(name, vtable_demangled_prefix) == name)
|
|
|
|
{
|
2012-03-29 01:13:26 +08:00
|
|
|
LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
|
|
|
|
if (log)
|
|
|
|
log->Printf ("0x%16.16llx: static-type = '%s' has vtable symbol '%s'\n",
|
|
|
|
original_ptr,
|
|
|
|
in_value.GetTypeName().GetCString(),
|
|
|
|
name);
|
|
|
|
// We are a C++ class, that's good. Get the class name and look it up:
|
2011-04-16 08:01:13 +08:00
|
|
|
const char *class_name = name + strlen(vtable_demangled_prefix);
|
2011-05-03 02:13:59 +08:00
|
|
|
class_type_or_name.SetName (class_name);
|
2012-03-27 07:03:23 +08:00
|
|
|
const bool exact_match = true;
|
2011-04-16 08:01:13 +08:00
|
|
|
TypeList class_types;
|
2012-04-07 01:41:13 +08:00
|
|
|
|
|
|
|
uint32_t num_matches = target->GetImages().FindTypes (sc,
|
|
|
|
ConstString(class_name),
|
|
|
|
exact_match,
|
|
|
|
UINT32_MAX,
|
|
|
|
class_types);
|
|
|
|
|
|
|
|
lldb::TypeSP type_sp;
|
2012-03-27 07:03:23 +08:00
|
|
|
if (num_matches == 0)
|
|
|
|
{
|
2012-03-29 01:13:26 +08:00
|
|
|
if (log)
|
|
|
|
log->Printf("0x%16.16llx: is not dynamic\n", original_ptr);
|
2012-03-27 07:03:23 +08:00
|
|
|
return false;
|
|
|
|
}
|
2011-04-16 08:01:13 +08:00
|
|
|
if (num_matches == 1)
|
|
|
|
{
|
2012-04-07 01:41:13 +08:00
|
|
|
type_sp = class_types.GetTypeAtIndex(0);
|
2012-03-29 01:13:26 +08:00
|
|
|
if (log)
|
|
|
|
log->Printf ("0x%16.16llx: static-type = '%s' has dynamic type: uid={0x%llx}, type-name='%s'\n",
|
|
|
|
original_ptr,
|
|
|
|
in_value.GetTypeName().AsCString(),
|
|
|
|
type_sp->GetID(),
|
|
|
|
type_sp->GetName().GetCString());
|
|
|
|
|
2011-05-03 02:13:59 +08:00
|
|
|
class_type_or_name.SetTypeSP(class_types.GetTypeAtIndex(0));
|
2011-04-16 08:01:13 +08:00
|
|
|
}
|
|
|
|
else if (num_matches > 1)
|
|
|
|
{
|
2012-04-07 01:41:13 +08:00
|
|
|
size_t i;
|
|
|
|
if (log)
|
2011-05-03 02:13:59 +08:00
|
|
|
{
|
2012-04-07 01:41:13 +08:00
|
|
|
for (i = 0; i < num_matches; i++)
|
2011-05-03 02:13:59 +08:00
|
|
|
{
|
2012-04-07 01:41:13 +08:00
|
|
|
type_sp = class_types.GetTypeAtIndex(i);
|
|
|
|
if (type_sp)
|
|
|
|
{
|
|
|
|
if (log)
|
|
|
|
log->Printf ("0x%16.16llx: static-type = '%s' has multiple matching dynamic types: uid={0x%llx}, type-name='%s'\n",
|
|
|
|
original_ptr,
|
|
|
|
in_value.GetTypeName().AsCString(),
|
|
|
|
type_sp->GetID(),
|
|
|
|
type_sp->GetName().GetCString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-03-27 07:03:23 +08:00
|
|
|
|
2012-04-07 01:41:13 +08:00
|
|
|
for (i = 0; i < num_matches; i++)
|
|
|
|
{
|
|
|
|
type_sp = class_types.GetTypeAtIndex(i);
|
|
|
|
if (type_sp)
|
|
|
|
{
|
|
|
|
if (ClangASTContext::IsCXXClassType(type_sp->GetClangFullType()))
|
|
|
|
{
|
|
|
|
if (log)
|
|
|
|
log->Printf ("0x%16.16llx: static-type = '%s' has multiple matching dynamic types, picking this one: uid={0x%llx}, type-name='%s'\n",
|
|
|
|
original_ptr,
|
|
|
|
in_value.GetTypeName().AsCString(),
|
|
|
|
type_sp->GetID(),
|
|
|
|
type_sp->GetName().GetCString());
|
|
|
|
class_type_or_name.SetTypeSP(type_sp);
|
|
|
|
break;
|
|
|
|
}
|
2011-05-03 02:13:59 +08:00
|
|
|
}
|
|
|
|
}
|
2011-04-16 08:01:13 +08:00
|
|
|
|
2012-04-07 01:41:13 +08:00
|
|
|
if (i == num_matches)
|
|
|
|
{
|
|
|
|
if (log)
|
|
|
|
log->Printf ("0x%16.16llx: static-type = '%s' has multiple matching dynamic types, didn't find a C++ match\n",
|
|
|
|
original_ptr,
|
|
|
|
in_value.GetTypeName().AsCString());
|
|
|
|
return false;
|
|
|
|
}
|
2011-04-16 08:01:13 +08:00
|
|
|
}
|
2012-04-07 01:41:13 +08:00
|
|
|
|
|
|
|
// There can only be one type with a given name,
|
|
|
|
// so we've just found duplicate definitions, and this
|
|
|
|
// one will do as well as any other.
|
|
|
|
// We don't consider something to have a dynamic type if
|
|
|
|
// it is the same as the static type. So compare against
|
|
|
|
// the value we were handed.
|
|
|
|
if (type_sp)
|
2011-04-16 08:01:13 +08:00
|
|
|
{
|
2012-04-07 01:41:13 +08:00
|
|
|
clang::ASTContext *in_ast_ctx = in_value.GetClangAST ();
|
|
|
|
clang::ASTContext *this_ast_ctx = type_sp->GetClangAST ();
|
|
|
|
if (in_ast_ctx == this_ast_ctx)
|
|
|
|
{
|
|
|
|
if (ClangASTContext::AreTypesSame (in_ast_ctx,
|
|
|
|
in_value.GetClangType(),
|
|
|
|
type_sp->GetClangFullType()))
|
|
|
|
{
|
|
|
|
// The dynamic type we found was the same type,
|
|
|
|
// so we don't have a dynamic type here...
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// The offset_to_top is two pointers above the address.
|
|
|
|
Address offset_to_top_address = address_point_address;
|
|
|
|
int64_t slide = -2 * ((int64_t) target->GetArchitecture().GetAddressByteSize());
|
|
|
|
offset_to_top_address.Slide (slide);
|
|
|
|
|
|
|
|
Error error;
|
|
|
|
lldb::addr_t offset_to_top_location = offset_to_top_address.GetLoadAddress(target);
|
|
|
|
|
|
|
|
size_t bytes_read = process->ReadMemory (offset_to_top_location,
|
|
|
|
memory_buffer,
|
|
|
|
address_byte_size,
|
|
|
|
error);
|
|
|
|
|
|
|
|
if (!error.Success() || (bytes_read != address_byte_size))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
offset_ptr = 0;
|
|
|
|
int64_t offset_to_top = data.GetMaxS64(&offset_ptr, process->GetAddressByteSize());
|
|
|
|
|
|
|
|
// So the dynamic type is a value that starts at offset_to_top
|
|
|
|
// above the original address.
|
|
|
|
lldb::addr_t dynamic_addr = original_ptr + offset_to_top;
|
|
|
|
if (!target->GetSectionLoadList().ResolveLoadAddress (dynamic_addr, dynamic_address))
|
|
|
|
{
|
|
|
|
dynamic_address.SetRawAddress(dynamic_addr);
|
|
|
|
}
|
|
|
|
return true;
|
2011-04-16 08:01:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2010-09-28 09:25:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ItaniumABILanguageRuntime::IsVTableName (const char *name)
|
|
|
|
{
|
|
|
|
if (name == NULL)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// Can we maybe ask Clang about this?
|
|
|
|
if (strstr (name, "_vptr$") == name)
|
|
|
|
return true;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-09-23 10:01:19 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
// Static Functions
|
|
|
|
//------------------------------------------------------------------
|
2012-03-03 10:05:11 +08:00
|
|
|
LanguageRuntime *
|
2010-09-23 10:01:19 +08:00
|
|
|
ItaniumABILanguageRuntime::CreateInstance (Process *process, lldb::LanguageType language)
|
|
|
|
{
|
|
|
|
// FIXME: We have to check the process and make sure we actually know that this process supports
|
|
|
|
// the Itanium ABI.
|
|
|
|
if (language == eLanguageTypeC_plus_plus)
|
|
|
|
return new ItaniumABILanguageRuntime (process);
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ItaniumABILanguageRuntime::Initialize()
|
|
|
|
{
|
|
|
|
PluginManager::RegisterPlugin (pluginName,
|
|
|
|
pluginDesc,
|
|
|
|
CreateInstance);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ItaniumABILanguageRuntime::Terminate()
|
|
|
|
{
|
|
|
|
PluginManager::UnregisterPlugin (CreateInstance);
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
// PluginInterface protocol
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
const char *
|
|
|
|
ItaniumABILanguageRuntime::GetPluginName()
|
|
|
|
{
|
|
|
|
return pluginName;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
ItaniumABILanguageRuntime::GetShortPluginName()
|
|
|
|
{
|
|
|
|
return pluginShort;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
ItaniumABILanguageRuntime::GetPluginVersion()
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2012-03-07 02:10:38 +08:00
|
|
|
static const char *exception_names[] = { "__cxa_begin_catch", "__cxa_throw", "__cxa_rethrow", "__cxa_allocate_exception"};
|
2012-03-03 10:05:11 +08:00
|
|
|
static const int num_throw_names = 3;
|
2012-03-07 02:10:38 +08:00
|
|
|
static const int num_expression_throw_names = 1;
|
2012-03-03 10:05:11 +08:00
|
|
|
|
2012-03-05 12:47:34 +08:00
|
|
|
BreakpointResolverSP
|
|
|
|
ItaniumABILanguageRuntime::CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp)
|
2012-03-07 02:10:38 +08:00
|
|
|
{
|
|
|
|
return CreateExceptionResolver (bkpt, catch_bp, throw_bp, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
BreakpointResolverSP
|
|
|
|
ItaniumABILanguageRuntime::CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp, bool for_expressions)
|
2012-03-03 10:05:11 +08:00
|
|
|
{
|
2012-03-05 12:47:34 +08:00
|
|
|
BreakpointResolverSP resolver_sp;
|
2012-03-07 02:10:38 +08:00
|
|
|
static const int total_expressions = sizeof (exception_names)/sizeof (char *);
|
|
|
|
|
|
|
|
// One complication here is that most users DON'T want to stop at __cxa_allocate_expression, but until we can do
|
|
|
|
// anything better with predicting unwinding the expression parser does. So we have two forms of the exception
|
|
|
|
// breakpoints, one for expressions that leaves out __cxa_allocate_exception, and one that includes it.
|
|
|
|
// The SetExceptionBreakpoints does the latter, the CreateExceptionBreakpoint in the runtime the former.
|
2012-03-05 12:47:34 +08:00
|
|
|
|
2012-03-07 02:10:38 +08:00
|
|
|
uint32_t num_expressions;
|
2012-03-03 10:05:11 +08:00
|
|
|
if (catch_bp && throw_bp)
|
2012-03-07 02:10:38 +08:00
|
|
|
{
|
|
|
|
if (for_expressions)
|
|
|
|
num_expressions = total_expressions;
|
|
|
|
else
|
|
|
|
num_expressions = total_expressions - num_expression_throw_names;
|
|
|
|
|
2012-03-05 12:47:34 +08:00
|
|
|
resolver_sp.reset (new BreakpointResolverName (bkpt,
|
|
|
|
exception_names,
|
2012-03-07 02:10:38 +08:00
|
|
|
num_expressions,
|
2012-03-05 12:47:34 +08:00
|
|
|
eFunctionNameTypeBase,
|
|
|
|
eLazyBoolNo));
|
2012-03-07 02:10:38 +08:00
|
|
|
}
|
2012-03-03 10:05:11 +08:00
|
|
|
else if (throw_bp)
|
2012-03-07 02:10:38 +08:00
|
|
|
{
|
|
|
|
if (for_expressions)
|
|
|
|
num_expressions = num_throw_names - num_expression_throw_names;
|
|
|
|
else
|
|
|
|
num_expressions = num_throw_names;
|
|
|
|
|
2012-03-05 12:47:34 +08:00
|
|
|
resolver_sp.reset (new BreakpointResolverName (bkpt,
|
2012-03-07 02:10:38 +08:00
|
|
|
exception_names + 1,
|
|
|
|
num_expressions,
|
2012-03-05 12:47:34 +08:00
|
|
|
eFunctionNameTypeBase,
|
|
|
|
eLazyBoolNo));
|
2012-03-07 02:10:38 +08:00
|
|
|
}
|
2012-03-03 10:05:11 +08:00
|
|
|
else if (catch_bp)
|
2012-03-05 12:47:34 +08:00
|
|
|
resolver_sp.reset (new BreakpointResolverName (bkpt,
|
2012-03-07 02:10:38 +08:00
|
|
|
exception_names,
|
|
|
|
total_expressions - num_throw_names,
|
2012-03-05 12:47:34 +08:00
|
|
|
eFunctionNameTypeBase,
|
|
|
|
eLazyBoolNo));
|
2012-03-03 10:05:11 +08:00
|
|
|
|
2012-03-05 12:47:34 +08:00
|
|
|
return resolver_sp;
|
2012-03-03 10:05:11 +08:00
|
|
|
}
|
|
|
|
|
2010-11-04 06:19:38 +08:00
|
|
|
void
|
|
|
|
ItaniumABILanguageRuntime::SetExceptionBreakpoints ()
|
|
|
|
{
|
|
|
|
if (!m_process)
|
|
|
|
return;
|
|
|
|
|
2012-03-03 10:05:11 +08:00
|
|
|
const bool catch_bp = false;
|
|
|
|
const bool throw_bp = true;
|
|
|
|
const bool is_internal = true;
|
2012-03-07 02:10:38 +08:00
|
|
|
const bool for_expressions = true;
|
|
|
|
|
|
|
|
// For the exception breakpoints set by the Expression parser, we'll be a little more aggressive and
|
|
|
|
// stop at exception allocation as well.
|
2012-03-03 10:05:11 +08:00
|
|
|
|
2010-11-04 06:19:38 +08:00
|
|
|
if (!m_cxx_exception_bp_sp)
|
2012-03-07 02:10:38 +08:00
|
|
|
{
|
|
|
|
Target &target = m_process->GetTarget();
|
|
|
|
|
|
|
|
BreakpointResolverSP exception_resolver_sp = CreateExceptionResolver (NULL, catch_bp, throw_bp, for_expressions);
|
|
|
|
SearchFilterSP filter_sp = target.GetSearchFilterForModule(NULL);
|
|
|
|
|
|
|
|
m_cxx_exception_bp_sp = target.CreateBreakpoint (filter_sp, exception_resolver_sp, is_internal);
|
|
|
|
}
|
2011-07-23 08:12:05 +08:00
|
|
|
else
|
|
|
|
m_cxx_exception_bp_sp->SetEnabled (true);
|
2010-11-04 06:19:38 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ItaniumABILanguageRuntime::ClearExceptionBreakpoints ()
|
|
|
|
{
|
|
|
|
if (!m_process)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (m_cxx_exception_bp_sp.get())
|
|
|
|
{
|
2011-07-23 08:12:05 +08:00
|
|
|
m_cxx_exception_bp_sp->SetEnabled (false);
|
2012-03-03 10:05:11 +08:00
|
|
|
}
|
2010-11-04 06:19:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ItaniumABILanguageRuntime::ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason)
|
|
|
|
{
|
|
|
|
if (!m_process)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (!stop_reason ||
|
|
|
|
stop_reason->GetStopReason() != eStopReasonBreakpoint)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
uint64_t break_site_id = stop_reason->GetValue();
|
2012-03-09 12:10:47 +08:00
|
|
|
return m_process->GetBreakpointSiteList().BreakpointSiteContainsBreakpoint(break_site_id,
|
|
|
|
m_cxx_exception_bp_sp->GetID());
|
2010-11-04 06:19:38 +08:00
|
|
|
|
|
|
|
}
|