Added function name types to allow us to set breakpoints by name more
intelligently. The four name types we currently have are:
eFunctionNameTypeFull = (1 << 1), // The function name.
// For C this is the same as just the name of the function
// For C++ this is the demangled version of the mangled name.
// For ObjC this is the full function signature with the + or
// - and the square brackets and the class and selector
eFunctionNameTypeBase = (1 << 2), // The function name only, no namespaces or arguments and no class
// methods or selectors will be searched.
eFunctionNameTypeMethod = (1 << 3), // Find function by method name (C++) with no namespace or arguments
eFunctionNameTypeSelector = (1 << 4) // Find function by selector name (ObjC) names
this allows much more flexibility when setting breakoints:
(lldb) breakpoint set --name main --basename
(lldb) breakpoint set --name main --fullname
(lldb) breakpoint set --name main --method
(lldb) breakpoint set --name main --selector
The default:
(lldb) breakpoint set --name main
will inspect the name "main" and look for any parens, or if the name starts
with "-[" or "+[" and if any are found then a full name search will happen.
Else a basename search will be the default.
Fixed some command option structures so not all options are required when they
shouldn't be.
Cleaned up the breakpoint output summary.
Made the "image lookup --address <addr>" output much more verbose so it shows
all the important symbol context results. Added a GetDescription method to
many of the SymbolContext objects for the more verbose output.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@107075 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/lldb/Breakpoint/BreakpointResolverName.h b/include/lldb/Breakpoint/BreakpointResolverName.h
index 63e6b86..4cfd245 100644
--- a/include/lldb/Breakpoint/BreakpointResolverName.h
+++ b/include/lldb/Breakpoint/BreakpointResolverName.h
@@ -30,17 +30,18 @@
public:
BreakpointResolverName (Breakpoint *bkpt,
- const char *func_name,
- Breakpoint::MatchType type = Breakpoint::Exact);
+ const char *name,
+ uint32_t name_type_mask,
+ Breakpoint::MatchType type);
// Creates a function breakpoint by regular expression. Takes over control of the lifespan of func_regex.
BreakpointResolverName (Breakpoint *bkpt,
- RegularExpression &func_regex);
+ RegularExpression &func_regex);
BreakpointResolverName (Breakpoint *bkpt,
- const char *class_name,
- const char *method,
- Breakpoint::MatchType type);
+ const char *class_name,
+ const char *method,
+ Breakpoint::MatchType type);
virtual
~BreakpointResolverName ();
@@ -62,6 +63,7 @@
protected:
ConstString m_func_name;
+ uint32_t m_func_name_type_mask; // See FunctionNameType
ConstString m_class_name; // FIXME: Not used yet. The idea would be to stop on methods of this class.
RegularExpression m_regex;
Breakpoint::MatchType m_match_type;
diff --git a/include/lldb/Core/Module.h b/include/lldb/Core/Module.h
index d985ae9..9de406d 100644
--- a/include/lldb/Core/Module.h
+++ b/include/lldb/Core/Module.h
@@ -157,6 +157,12 @@
/// @param[in] name
/// The name of the function we are looking for.
///
+ /// @param[in] name_type_mask
+ /// A bit mask of bits that indicate what kind of names should
+ /// be used when doing the lookup. Bits include fully qualified
+ /// names, base names, C++ methods, or ObjC selectors.
+ /// See FunctionNameType for more details.
+ ///
/// @param[in] append
/// If \b true, any matches will be appended to \a
/// variable_list, else matches replace the contents of
@@ -170,7 +176,7 @@
/// The number of matches added to \a sc_list.
//------------------------------------------------------------------
uint32_t
- FindFunctions (const ConstString &name, bool append, SymbolContextList& sc_list);
+ FindFunctions (const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list);
//------------------------------------------------------------------
/// Find functions by name.
diff --git a/include/lldb/Core/ModuleList.h b/include/lldb/Core/ModuleList.h
index e495902..6a392b1 100644
--- a/include/lldb/Core/ModuleList.h
+++ b/include/lldb/Core/ModuleList.h
@@ -144,6 +144,12 @@
/// @param[in] name
/// The name of the function we are looking for.
///
+ /// @param[in] name_type_mask
+ /// A bit mask of bits that indicate what kind of names should
+ /// be used when doing the lookup. Bits include fully qualified
+ /// names, base names, C++ methods, or ObjC selectors.
+ /// See FunctionNameType for more details.
+ ///
/// @param[out] sc_list
/// A symbol context list that gets filled in with all of the
/// matches.
@@ -153,6 +159,7 @@
//------------------------------------------------------------------
size_t
FindFunctions (const ConstString &name,
+ uint32_t name_type_mask,
SymbolContextList &sc_list);
//------------------------------------------------------------------
diff --git a/include/lldb/Core/VMRange.h b/include/lldb/Core/VMRange.h
index b97059f..c0bba12 100644
--- a/include/lldb/Core/VMRange.h
+++ b/include/lldb/Core/VMRange.h
@@ -112,7 +112,7 @@
}
void
- Dump(Stream *s, lldb::addr_t base_addr = 0) const;
+ Dump (Stream *s, lldb::addr_t base_addr = 0, uint32_t addr_width = 8) const;
class ValueInRangeUnaryPredicate
{
diff --git a/include/lldb/Symbol/Block.h b/include/lldb/Symbol/Block.h
index 85c981c..13c5d38 100644
--- a/include/lldb/Symbol/Block.h
+++ b/include/lldb/Symbol/Block.h
@@ -213,6 +213,11 @@
virtual void
DumpSymbolContext(Stream *s);
+ void
+ GetDescription (Stream *s,
+ lldb::DescriptionLevel level,
+ Process *process) const;
+
//------------------------------------------------------------------
/// Get the parent block's UID.
///
@@ -243,6 +248,37 @@
lldb::user_id_t
GetFirstChildUID () const;
+
+ //------------------------------------------------------------------
+ /// Get the parent block.
+ ///
+ /// @return
+ /// The parent block pointer, or NULL if this block has no
+ /// parent.
+ //------------------------------------------------------------------
+ Block *
+ GetParent () const;
+
+ //------------------------------------------------------------------
+ /// Get the sibling block.
+ ///
+ /// @return
+ /// The sibling block pointer, or NULL if this block has no
+ /// sibling.
+ //------------------------------------------------------------------
+ Block *
+ GetSibling () const;
+
+ //------------------------------------------------------------------
+ /// Get the first child block.
+ ///
+ /// @return
+ /// The first child block pointer, or NULL if this block has no
+ /// children.
+ //------------------------------------------------------------------
+ Block *
+ GetFirstChild () const;
+
//------------------------------------------------------------------
/// Get the variable list for this block and optionally all child
/// blocks if \a get_child_variables is \b true.
diff --git a/include/lldb/Symbol/CompileUnit.h b/include/lldb/Symbol/CompileUnit.h
index ab1b587..779363f 100644
--- a/include/lldb/Symbol/CompileUnit.h
+++ b/include/lldb/Symbol/CompileUnit.h
@@ -135,6 +135,10 @@
virtual void
DumpSymbolContext(Stream *s);
+
+ void
+ GetDescription(Stream *s, lldb::DescriptionLevel level) const;
+
//------------------------------------------------------------------
/// Get a shared pointer to a function in this compile unit by
/// index.
diff --git a/include/lldb/Symbol/Function.h b/include/lldb/Symbol/Function.h
index f52bcf0..b4c1e8b 100644
--- a/include/lldb/Symbol/Function.h
+++ b/include/lldb/Symbol/Function.h
@@ -451,6 +451,9 @@
const CompileUnit*
GetCompileUnit() const;
+ void
+ GetDescription(Stream *s, lldb::DescriptionLevel level, Process *process);
+
//------------------------------------------------------------------
/// Get accessor for the frame base location.
///
diff --git a/include/lldb/Symbol/LineEntry.h b/include/lldb/Symbol/LineEntry.h
index e0e6d29..f9e685e 100644
--- a/include/lldb/Symbol/LineEntry.h
+++ b/include/lldb/Symbol/LineEntry.h
@@ -87,8 +87,12 @@
Dump (Stream *s, Process *process, bool show_file, Address::DumpStyle style, Address::DumpStyle fallback_style, bool show_range) const;
bool
- GetDescription (Stream *s, lldb::DescriptionLevel level, CompileUnit* cu, Process *process) const;
-
+ GetDescription (Stream *s,
+ lldb::DescriptionLevel level,
+ CompileUnit* cu,
+ Process *process,
+ bool show_address_only) const;
+
//------------------------------------------------------------------
/// Dumps information specific to a process that stops at this
/// line entry to the supplied stream \a s.
diff --git a/include/lldb/Symbol/Symbol.h b/include/lldb/Symbol/Symbol.h
index dedc451..ee4c2b4 100644
--- a/include/lldb/Symbol/Symbol.h
+++ b/include/lldb/Symbol/Symbol.h
@@ -106,6 +106,9 @@
void
SetFlags (uint32_t flags) { m_flags = flags; }
+ void
+ GetDescription (Stream *s, lldb::DescriptionLevel level, Process *process) const;
+
Function *
GetFunction ();
diff --git a/include/lldb/Symbol/SymbolContext.h b/include/lldb/Symbol/SymbolContext.h
index c0aff6e..be3ee3c 100644
--- a/include/lldb/Symbol/SymbolContext.h
+++ b/include/lldb/Symbol/SymbolContext.h
@@ -184,6 +184,12 @@
bool
GetAddressRange (uint32_t scope, AddressRange &range) const;
+
+ void
+ GetDescription(Stream *s,
+ lldb::DescriptionLevel level,
+ Process *process) const;
+
//------------------------------------------------------------------
/// Find a function matching the given name, working out from this
/// symbol context.
diff --git a/include/lldb/Symbol/SymbolFile.h b/include/lldb/Symbol/SymbolFile.h
index 4af88c3..b1faee6 100644
--- a/include/lldb/Symbol/SymbolFile.h
+++ b/include/lldb/Symbol/SymbolFile.h
@@ -75,7 +75,7 @@
virtual uint32_t ResolveSymbolContext (const FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list) = 0;
virtual uint32_t FindGlobalVariables (const ConstString &name, bool append, uint32_t max_matches, VariableList& variables) = 0;
virtual uint32_t FindGlobalVariables (const RegularExpression& regex, bool append, uint32_t max_matches, VariableList& variables) = 0;
- virtual uint32_t FindFunctions (const ConstString &name, bool append, SymbolContextList& sc_list) = 0;
+ virtual uint32_t FindFunctions (const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list) = 0;
virtual uint32_t FindFunctions (const RegularExpression& regex, bool append, SymbolContextList& sc_list) = 0;
// virtual uint32_t FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, Type::Encoding encoding, lldb::user_id_t udt_uid, TypeList& types) = 0;
// virtual uint32_t FindTypes (const SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, Type::Encoding encoding, lldb::user_id_t udt_uid, TypeList& types) = 0;
diff --git a/include/lldb/Symbol/SymbolVendor.h b/include/lldb/Symbol/SymbolVendor.h
index a5bdb3b..11922c2 100644
--- a/include/lldb/Symbol/SymbolVendor.h
+++ b/include/lldb/Symbol/SymbolVendor.h
@@ -110,6 +110,7 @@
virtual uint32_t
FindFunctions(const ConstString &name,
+ uint32_t name_type_mask,
bool append,
SymbolContextList& sc_list);
diff --git a/include/lldb/Symbol/Type.h b/include/lldb/Symbol/Type.h
index 9d7810a..c25675e 100644
--- a/include/lldb/Symbol/Type.h
+++ b/include/lldb/Symbol/Type.h
@@ -58,6 +58,10 @@
void
DumpTypeName(Stream *s);
+
+ void
+ GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_name);
+
SymbolFile *
GetSymbolFile()
{
diff --git a/include/lldb/Target/Target.h b/include/lldb/Target/Target.h
index 6f5f05e..055b5cf 100644
--- a/include/lldb/Target/Target.h
+++ b/include/lldb/Target/Target.h
@@ -138,6 +138,7 @@
lldb::BreakpointSP
CreateBreakpoint (FileSpec *containingModule,
const char *func_name,
+ uint32_t func_name_type_mask,
bool internal = false);
// Use this to create a general breakpoint:
diff --git a/include/lldb/lldb-enumerations.h b/include/lldb/lldb-enumerations.h
index cf0237a..17622a8 100644
--- a/include/lldb/lldb-enumerations.h
+++ b/include/lldb/lldb-enumerations.h
@@ -390,6 +390,20 @@
kNumArchTypes
} ArchitectureType;
+typedef enum FunctionNameType
+{
+ eFunctionNameTypeNone = 0,
+ eFunctionNameTypeFull = (1 << 1), // The function name.
+ // For C this is the same as just the name of the function
+ // For C++ this is the demangled version of the mangled name.
+ // For ObjC this is the full function signature with the + or
+ // - and the square brackets and the class and selector
+ eFunctionNameTypeBase = (1 << 2), // The function name only, no namespaces or arguments and no class
+ // methods or selectors will be searched.
+ eFunctionNameTypeMethod = (1 << 3), // Find function by method name (C++) with no namespace or arguments
+ eFunctionNameTypeSelector = (1 << 4) // Find function by selector name (ObjC) names
+} FunctionNameType;
+
} // namespace lldb
diff --git a/lldb.xcodeproj/project.pbxproj b/lldb.xcodeproj/project.pbxproj
index 7f23569..db04ce6 100644
--- a/lldb.xcodeproj/project.pbxproj
+++ b/lldb.xcodeproj/project.pbxproj
@@ -1621,6 +1621,8 @@
26BC7E9310F1B85900F91463 /* StreamString.cpp */,
9A35765E116E76A700E8ED2F /* StringList.h */,
9A35765F116E76B900E8ED2F /* StringList.cpp */,
+ 26B167A41123BF5500DC7B4F /* ThreadSafeValue.h */,
+ 263FEDA5112CC1DA00E4C208 /* ThreadSafeSTLMap.h */,
26BC7D7E10F1B77400F91463 /* Timer.h */,
26BC7E9610F1B85900F91463 /* Timer.cpp */,
26BC7D7F10F1B77400F91463 /* TTYState.h */,
@@ -1628,6 +1630,8 @@
268A813F115B19D000F645B0 /* UniqueCStringMap.h */,
26BC7D8010F1B77400F91463 /* UserID.h */,
26BC7E9810F1B85900F91463 /* UserID.cpp */,
+ 26C81CA411335651004BDC5A /* UUID.h */,
+ 26C81CA511335651004BDC5A /* UUID.cpp */,
26BC7D8110F1B77400F91463 /* Value.h */,
26BC7E9910F1B85900F91463 /* Value.cpp */,
26BC7D8210F1B77400F91463 /* ValueObject.h */,
@@ -1642,10 +1646,6 @@
26BC7E9D10F1B85900F91463 /* ValueObjectVariable.cpp */,
26BC7D8610F1B77400F91463 /* VMRange.h */,
26BC7E9E10F1B85900F91463 /* VMRange.cpp */,
- 26B167A41123BF5500DC7B4F /* ThreadSafeValue.h */,
- 263FEDA5112CC1DA00E4C208 /* ThreadSafeSTLMap.h */,
- 26C81CA411335651004BDC5A /* UUID.h */,
- 26C81CA511335651004BDC5A /* UUID.cpp */,
);
name = Core;
sourceTree = "<group>";
diff --git a/source/Breakpoint/Breakpoint.cpp b/source/Breakpoint/Breakpoint.cpp
index fb277b2..12dceac 100644
--- a/source/Breakpoint/Breakpoint.cpp
+++ b/source/Breakpoint/Breakpoint.cpp
@@ -349,17 +349,9 @@
Breakpoint::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_locations)
{
assert (s != NULL);
- StreamString filter_strm;
-
-
- s->Printf("%i ", GetID());
+ s->Printf("%i: ", GetID());
GetResolverDescription (s);
- GetFilterDescription (&filter_strm);
- if (filter_strm.GetString().compare ("No Filter") != 0)
- {
- s->Printf (", ");
- GetFilterDescription (s);
- }
+ GetFilterDescription (s);
const uint32_t num_locations = GetNumLocations ();
const uint32_t num_resolved_locations = GetNumResolvedLocations ();
@@ -370,14 +362,13 @@
case lldb::eDescriptionLevelFull:
if (num_locations > 0)
{
- s->Printf(" with %u location%s", num_locations, num_locations > 1 ? "s" : "");
+ s->Printf(", locations = %u", num_locations);
if (num_resolved_locations > 0)
- s->Printf(" (%u resolved)", num_resolved_locations);
- s->PutChar(';');
+ s->Printf(", resolved = %u", num_resolved_locations);
}
else
{
- s->Printf(" with 0 locations (Pending Breakpoint).");
+ s->Printf(", locations = 0 (pending)");
}
GetOptions()->GetDescription(s, level);
@@ -400,7 +391,6 @@
if (show_locations)
{
- s->EOL();
s->IndentMore();
for (int i = 0; i < GetNumLocations(); ++i)
{
@@ -409,7 +399,6 @@
s->EOL();
}
s->IndentLess();
-
}
}
diff --git a/source/Breakpoint/BreakpointOptions.cpp b/source/Breakpoint/BreakpointOptions.cpp
index fae9a7b..aa89c44 100644
--- a/source/Breakpoint/BreakpointOptions.cpp
+++ b/source/Breakpoint/BreakpointOptions.cpp
@@ -234,10 +234,7 @@
if (level != eDescriptionLevelBrief)
s->EOL();
m_callback_baton_sp->GetDescription (s, level);
- }
- else if (level == eDescriptionLevelBrief)
- s->PutCString ("commands: no ");
-
+ }
}
void
@@ -247,10 +244,7 @@
if (level == eDescriptionLevelBrief)
{
- if (data && data->user_source.GetSize() > 0)
- s->PutCString("commands: yes ");
- else
- s->PutCString("commands: no ");
+ s->Printf (", commands = %s", (data && data->user_source.GetSize() > 0) ? "yes" : "no");
return;
}
diff --git a/source/Breakpoint/BreakpointResolverAddress.cpp b/source/Breakpoint/BreakpointResolverAddress.cpp
index 034ef60..3e462d0 100644
--- a/source/Breakpoint/BreakpointResolverAddress.cpp
+++ b/source/Breakpoint/BreakpointResolverAddress.cpp
@@ -100,7 +100,7 @@
void
BreakpointResolverAddress::GetDescription (Stream *s)
{
- s->PutCString ("Address breakpoint: ");
+ s->PutCString ("address = ");
m_addr.Dump(s, m_breakpoint->GetTarget().GetProcessSP().get(), Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress);
}
diff --git a/source/Breakpoint/BreakpointResolverFileLine.cpp b/source/Breakpoint/BreakpointResolverFileLine.cpp
index 86e0596..da015dc 100644
--- a/source/Breakpoint/BreakpointResolverFileLine.cpp
+++ b/source/Breakpoint/BreakpointResolverFileLine.cpp
@@ -111,7 +111,7 @@
void
BreakpointResolverFileLine::GetDescription (Stream *s)
{
- s->Printf ("File and line breakpoint - file: \"%s\" line: %u", m_file_spec.GetFilename().AsCString(), m_line_number);
+ s->Printf ("file ='%s', line = %u", m_file_spec.GetFilename().AsCString(), m_line_number);
}
void
diff --git a/source/Breakpoint/BreakpointResolverName.cpp b/source/Breakpoint/BreakpointResolverName.cpp
index b04bb8a..f25910d 100644
--- a/source/Breakpoint/BreakpointResolverName.cpp
+++ b/source/Breakpoint/BreakpointResolverName.cpp
@@ -25,11 +25,13 @@
(
Breakpoint *bkpt,
const char *func_name,
+ uint32_t func_name_type_mask,
Breakpoint::MatchType type
) :
BreakpointResolver (bkpt),
m_func_name (func_name),
- m_class_name (NULL),
+ m_func_name_type_mask (func_name_type_mask),
+ m_class_name (),
m_regex (),
m_match_type (type)
{
@@ -94,45 +96,47 @@
{
SymbolContextList func_list;
SymbolContextList sym_list;
-
+
bool skip_prologue = true;
uint32_t i;
bool new_location;
SymbolContext sc;
Address break_addr;
assert (m_breakpoint != NULL);
-
+
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
-
+
if (m_class_name)
{
if (log)
log->Warning ("Class/method function specification not supported yet.\n");
return Searcher::eCallbackReturnStop;
}
-
+
switch (m_match_type)
{
- case Breakpoint::Exact:
- if (context.module_sp)
- {
- context.module_sp->FindSymbolsWithNameAndType (m_func_name, eSymbolTypeCode, sym_list);
- context.module_sp->FindFunctions (m_func_name, false, func_list);
- }
- break;
- case Breakpoint::Regexp:
- if (context.module_sp)
- {
- context.module_sp->FindSymbolsMatchingRegExAndType (m_regex, eSymbolTypeCode, sym_list);
- context.module_sp->FindFunctions (m_regex, true, func_list);
- }
- break;
- case Breakpoint::Glob:
- if (log)
- log->Warning ("glob is not supported yet.");
- break;
+ case Breakpoint::Exact:
+ if (context.module_sp)
+ {
+ if (m_func_name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull))
+ context.module_sp->FindSymbolsWithNameAndType (m_func_name, eSymbolTypeCode, sym_list);
+ context.module_sp->FindFunctions (m_func_name, m_func_name_type_mask, false, func_list);
+ }
+ break;
+ case Breakpoint::Regexp:
+ if (context.module_sp)
+ {
+ if (m_func_name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull))
+ context.module_sp->FindSymbolsMatchingRegExAndType (m_regex, eSymbolTypeCode, sym_list);
+ context.module_sp->FindFunctions (m_regex, true, func_list);
+ }
+ break;
+ case Breakpoint::Glob:
+ if (log)
+ log->Warning ("glob is not supported yet.");
+ break;
}
-
+
// Remove any duplicates between the funcion list and the symbol list
if (func_list.GetSize())
{
@@ -140,7 +144,7 @@
{
if (func_list.GetContextAtIndex(i, sc) == false)
continue;
-
+
if (sc.function == NULL)
continue;
uint32_t j = 0;
@@ -158,11 +162,11 @@
}
}
}
-
+
j++;
}
}
-
+
for (i = 0; i < func_list.GetSize(); i++)
{
if (func_list.GetContextAtIndex(i, sc))
@@ -176,7 +180,7 @@
if (prologue_byte_size)
break_addr.SetOffset(break_addr.GetOffset() + prologue_byte_size);
}
-
+
if (filter.AddressPasses(break_addr))
{
BreakpointLocationSP bp_loc_sp (m_breakpoint->AddLocation(break_addr, &new_location));
@@ -194,7 +198,7 @@
}
}
}
-
+
for (i = 0; i < sym_list.GetSize(); i++)
{
if (sym_list.GetContextAtIndex(i, sc))
@@ -202,14 +206,14 @@
if (sc.symbol && sc.symbol->GetAddressRangePtr())
{
break_addr = sc.symbol->GetAddressRangePtr()->GetBaseAddress();
-
+
if (skip_prologue)
{
const uint32_t prologue_byte_size = sc.symbol->GetPrologueByteSize();
if (prologue_byte_size)
break_addr.SetOffset(break_addr.GetOffset() + prologue_byte_size);
}
-
+
if (filter.AddressPasses(break_addr))
{
BreakpointLocationSP bp_loc_sp (m_breakpoint->AddLocation(break_addr, &new_location));
@@ -236,12 +240,10 @@
void
BreakpointResolverName::GetDescription (Stream *s)
{
- s->PutCString("Breakpoint by name: ");
-
if (m_match_type == Breakpoint::Regexp)
- s->Printf("'%s' (regular expression)", m_regex.GetText());
+ s->Printf("regex = '%s'", m_regex.GetText());
else
- s->Printf("'%s'", m_func_name.AsCString());
+ s->Printf("name = '%s'", m_func_name.AsCString());
}
void
diff --git a/source/Commands/CommandObjectBreakpoint.cpp b/source/Commands/CommandObjectBreakpoint.cpp
index 01d29fb..830fbec 100644
--- a/source/Commands/CommandObjectBreakpoint.cpp
+++ b/source/Commands/CommandObjectBreakpoint.cpp
@@ -52,6 +52,7 @@
m_column (0),
m_ignore_inlines (false),
m_func_name (),
+ m_func_name_type_mask (0),
m_func_regexp (),
m_modules (),
m_load_addr(),
@@ -70,31 +71,28 @@
lldb::OptionDefinition
CommandObjectBreakpointSet::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_ALL, false, "shlib", 's', required_argument, NULL, CommandCompletions::eModuleCompletion, "<shlib-name>",
+ { LLDB_OPT_SET_ALL, false, "shlib", 's', required_argument, NULL, CommandCompletions::eModuleCompletion, "<shlib-name>",
"Set the breakpoint only in this shared library (can use this option multiple times for multiple shlibs)."},
- { LLDB_OPT_SET_ALL, false, "ignore_inlines", 'i', no_argument, NULL, 0, NULL,
- "Ignore inlined subroutines when setting the breakppoint." },
-
- { LLDB_OPT_SET_ALL, false, "ignore_count", 'k', required_argument, NULL, 0, NULL,
+ { LLDB_OPT_SET_ALL, false, "ignore_count", 'k', required_argument, NULL, 0, "<n>",
"Set the number of times this breakpoint is sKipped before stopping." },
- { LLDB_OPT_SET_ALL, false, "thread_index", 'x', required_argument, NULL, NULL, "<thread_index>",
+ { LLDB_OPT_SET_ALL, false, "thread_index", 'x', required_argument, NULL, NULL, "<thread_index>",
"The breakpoint stops only for the thread whose indeX matches this argument."},
- { LLDB_OPT_SET_ALL, false, "thread_id", 't', required_argument, NULL, NULL, "<thread_id>",
+ { LLDB_OPT_SET_ALL, false, "thread_id", 't', required_argument, NULL, NULL, "<thread_id>",
"The breakpoint stops only for the thread whose TID matches this argument."},
- { LLDB_OPT_SET_ALL, false, "thread_name", 'T', required_argument, NULL, NULL, "<thread_name>",
+ { LLDB_OPT_SET_ALL, false, "thread_name", 'T', required_argument, NULL, NULL, "<thread_name>",
"The breakpoint stops only for the thread whose thread name matches this argument."},
- { LLDB_OPT_SET_ALL, false, "queue_name", 'q', required_argument, NULL, NULL, "<queue_name>",
+ { LLDB_OPT_SET_ALL, false, "queue_name", 'q', required_argument, NULL, NULL, "<queue_name>",
"The breakpoint stops only for threads in the queue whose name is given by this argument."},
- { LLDB_OPT_SET_1, false, "file", 'f', required_argument, NULL, CommandCompletions::eSourceFileCompletion, "<filename>",
+ { LLDB_OPT_SET_1, false, "file", 'f', required_argument, NULL, CommandCompletions::eSourceFileCompletion, "<filename>",
"Set the breakpoint by source location in this particular file."},
- { LLDB_OPT_SET_1, true, "line", 'l', required_argument, NULL, 0, "<linenum>",
+ { LLDB_OPT_SET_1, true, "line", 'l', required_argument, NULL, 0, "<linenum>",
"Set the breakpoint by source location at this particular line."},
// Comment out this option for the moment, as we don't actually use it, but will in the future.
@@ -102,12 +100,24 @@
// { 0, false, "column", 'c', required_argument, NULL, "<column>",
// "Set the breakpoint by source location at this particular column."},
- { LLDB_OPT_SET_2, true, "address", 'a', required_argument, NULL, 0, "<address>",
+ { LLDB_OPT_SET_2, true, "address", 'a', required_argument, NULL, 0, "<address>",
"Set the breakpoint by address, at the specified address."},
- { LLDB_OPT_SET_3, true, "name", 'n', required_argument, NULL, CommandCompletions::eSymbolCompletion, "<function-name>",
+ { LLDB_OPT_SET_3, true, "name", 'n', required_argument, NULL, CommandCompletions::eSymbolCompletion, "<name>",
"Set the breakpoint by function name." },
+ { LLDB_OPT_SET_3, false, "basename", 'b', no_argument, NULL, 0, NULL,
+ "Used in conjuction with --name <name> to search function basenames." },
+
+ { LLDB_OPT_SET_3, false, "fullname", 'F', no_argument, NULL, 0, NULL,
+ "Used in conjuction with --name <name> to search fully qualified function names. For C++ this means namespaces and all arguemnts, and for Objective C this means a full function prototype with class and selector." },
+
+ { LLDB_OPT_SET_3, false, "selector", 'S', no_argument, NULL, 0, NULL,
+ "Used in conjuction with --name <name> to search objective C selector names." },
+
+ { LLDB_OPT_SET_3, false, "method", 'm', no_argument, NULL, 0, NULL,
+ "Used in conjuction with --name <name> to search objective C selector C++ method names." },
+
{ LLDB_OPT_SET_4, true, "func_regex", 'r', required_argument, NULL, 0, "<regular-expression>",
"Set the breakpoint by function name, evaluating a regular-expression to find the function name(s)." },
@@ -140,21 +150,39 @@
case 'c':
m_column = Args::StringToUInt32 (option_arg, 0);
break;
+
case 'f':
m_filename = option_arg;
break;
- case 'i':
- m_ignore_inlines = true;
- break;
+
case 'l':
m_line_num = Args::StringToUInt32 (option_arg, 0);
break;
+
case 'n':
m_func_name = option_arg;
break;
+
+ case 'b':
+ m_func_name_type_mask |= eFunctionNameTypeBase;
+ break;
+
+ case 'F':
+ m_func_name_type_mask |= eFunctionNameTypeFull;
+ break;
+
+ case 'S':
+ m_func_name_type_mask |= eFunctionNameTypeSelector;
+ break;
+
+ case 'm':
+ m_func_name_type_mask |= eFunctionNameTypeMethod;
+ break;
+
case 'r':
m_func_regexp = option_arg;
break;
+
case 's':
{
m_modules.push_back (std::string (option_arg));
@@ -204,8 +232,8 @@
m_filename.clear();
m_line_num = 0;
m_column = 0;
- m_ignore_inlines = false;
m_func_name.clear();
+ m_func_name_type_mask = 0;
m_func_regexp.clear();
m_load_addr = LLDB_INVALID_ADDRESS;
m_modules.clear();
@@ -357,32 +385,50 @@
case eSetTypeAddress: // Breakpoint by address
bp = target->CreateBreakpoint (m_options.m_load_addr, false).get();
break;
+
case eSetTypeFunctionName: // Breakpoint by function name
- if (use_module)
{
- for (int i = 0; i < num_modules; ++i)
+ uint32_t name_type_mask = m_options.m_func_name_type_mask;
+
+ if (name_type_mask == 0)
{
- module.SetFile(m_options.m_modules[i].c_str());
- bp = target->CreateBreakpoint (&module, m_options.m_func_name.c_str()).get();
- if (bp)
- {
- StreamString &output_stream = result.GetOutputStream();
- output_stream.Printf ("Breakpoint created: ");
- bp->GetDescription(&output_stream, lldb::eDescriptionLevelBrief);
- output_stream.EOL();
- result.SetStatus (eReturnStatusSuccessFinishResult);
- }
+
+ if (m_options.m_func_name.find('(') != std::string::npos ||
+ m_options.m_func_name.find("-[") == 0 ||
+ m_options.m_func_name.find("+[") == 0)
+ name_type_mask |= eFunctionNameTypeFull;
else
+ name_type_mask |= eFunctionNameTypeBase;
+ }
+
+
+ if (use_module)
+ {
+ for (int i = 0; i < num_modules; ++i)
{
- result.AppendErrorWithFormat("Breakpoint creation failed: No breakpoint created in module '%s'.\n",
- m_options.m_modules[i].c_str());
- result.SetStatus (eReturnStatusFailed);
+ module.SetFile(m_options.m_modules[i].c_str());
+ bp = target->CreateBreakpoint (&module, m_options.m_func_name.c_str(), name_type_mask, Breakpoint::Exact).get();
+ if (bp)
+ {
+ StreamString &output_stream = result.GetOutputStream();
+ output_stream.Printf ("Breakpoint created: ");
+ bp->GetDescription(&output_stream, lldb::eDescriptionLevelBrief);
+ output_stream.EOL();
+ result.SetStatus (eReturnStatusSuccessFinishResult);
+ }
+ else
+ {
+ result.AppendErrorWithFormat("Breakpoint creation failed: No breakpoint created in module '%s'.\n",
+ m_options.m_modules[i].c_str());
+ result.SetStatus (eReturnStatusFailed);
+ }
}
}
+ else
+ bp = target->CreateBreakpoint (NULL, m_options.m_func_name.c_str(), name_type_mask, Breakpoint::Exact).get();
}
- else
- bp = target->CreateBreakpoint (NULL, m_options.m_func_name.c_str()).get();
break;
+
case eSetTypeFunctionRegexp: // Breakpoint by regular expression function name
{
RegularExpression regexp(m_options.m_func_regexp.c_str());
@@ -412,6 +458,7 @@
bp = target->CreateBreakpoint (NULL, regexp).get();
}
break;
+
default:
break;
}
diff --git a/source/Commands/CommandObjectBreakpoint.h b/source/Commands/CommandObjectBreakpoint.h
index 92bea69..20f2c3b 100644
--- a/source/Commands/CommandObjectBreakpoint.h
+++ b/source/Commands/CommandObjectBreakpoint.h
@@ -98,10 +98,11 @@
// Instance variables to hold the values for command options.
std::string m_filename;
- unsigned int m_line_num;
- unsigned int m_column;
+ uint32_t m_line_num;
+ uint32_t m_column;
bool m_ignore_inlines;
std::string m_func_name;
+ uint32_t m_func_name_type_mask;
std::string m_func_regexp;
lldb::addr_t m_load_addr;
STLStringArray m_modules;
diff --git a/source/Commands/CommandObjectCall.cpp b/source/Commands/CommandObjectCall.cpp
index a2cbc05..12281b3 100644
--- a/source/Commands/CommandObjectCall.cpp
+++ b/source/Commands/CommandObjectCall.cpp
@@ -295,7 +295,7 @@
lldb::OptionDefinition
CommandObjectCall::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_1, true, "language", 'l', required_argument, NULL, 0, "[c|c++|objc|objc++]", "Sets the language to use when parsing the expression."},
+{ LLDB_OPT_SET_1, false, "language", 'l', required_argument, NULL, 0, "[c|c++|objc|objc++]", "Sets the language to use when parsing the expression."},
{ LLDB_OPT_SET_1, false, "format", 'f', required_argument, NULL, 0, "[ [bool|b] | [bin] | [char|c] | [oct|o] | [dec|i|d|u] | [hex|x] | [float|f] | [cstr|s] ]", "Specify the format that the expression output should use."},
{ LLDB_OPT_SET_1, false, "debug", 'g', no_argument, NULL, 0, NULL, "Enable verbose debug logging of the expression parsing and evaluation."},
{ LLDB_OPT_SET_1, false, "noexecute", 'n', no_argument, NULL, 0, "no execute", "Only JIT and copy the wrapper & arguments, but don't execute."},
diff --git a/source/Commands/CommandObjectDisassemble.cpp b/source/Commands/CommandObjectDisassemble.cpp
index c2abeee..c5fbbea 100644
--- a/source/Commands/CommandObjectDisassemble.cpp
+++ b/source/Commands/CommandObjectDisassemble.cpp
@@ -389,7 +389,9 @@
{
SymbolContextList sc_list;
- if (target->GetImages().FindFunctions(name, sc_list))
+ if (target->GetImages().FindFunctions(name,
+ eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeMethod | eFunctionNameTypeSelector,
+ sc_list))
{
Disassemble (interpreter, result, disassembler, sc_list);
}
diff --git a/source/Commands/CommandObjectExpression.cpp b/source/Commands/CommandObjectExpression.cpp
index 7ddd3a1..e98303c 100644
--- a/source/Commands/CommandObjectExpression.cpp
+++ b/source/Commands/CommandObjectExpression.cpp
@@ -456,7 +456,7 @@
lldb::OptionDefinition
CommandObjectExpression::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_ALL, true, "language", 'l', required_argument, NULL, 0, "[c|c++|objc|objc++]", "Sets the language to use when parsing the expression."},
+{ LLDB_OPT_SET_ALL, false, "language", 'l', required_argument, NULL, 0, "[c|c++|objc|objc++]", "Sets the language to use when parsing the expression."},
{ LLDB_OPT_SET_ALL, false, "format", 'f', required_argument, NULL, 0, "[ [bool|b] | [bin] | [char|c] | [oct|o] | [dec|i|d|u] | [hex|x] | [float|f] | [cstr|s] ]", "Specify the format that the expression output should use."},
{ LLDB_OPT_SET_ALL, false, "debug", 'g', no_argument, NULL, 0, NULL, "Enable verbose debug logging of the expression parsing and evaluation."},
{ LLDB_OPT_SET_ALL, false, "use-ir", 'i', no_argument, NULL, 0, NULL, "[Temporary] Instructs the expression evaluator to use IR instead of ASTs."},
diff --git a/source/Commands/CommandObjectImage.cpp b/source/Commands/CommandObjectImage.cpp
index 38a04ec..cb717c4 100644
--- a/source/Commands/CommandObjectImage.cpp
+++ b/source/Commands/CommandObjectImage.cpp
@@ -227,9 +227,12 @@
strm.Printf("0x%llx: ", addr);
ExecutionContextScope *exe_scope = interpreter.GetDebugger().GetExecutionContext().GetBestExecutionContextScope();
- if (so_addr.Dump (&strm, exe_scope, Address::DumpStyleSectionNameOffset))
- strm.PutCString(": ");
+ strm.IndentMore();
+ strm.Indent (" Address: ");
+ so_addr.Dump (&strm, exe_scope, Address::DumpStyleSectionNameOffset);
+ strm.EOL();
so_addr.Dump (&strm, exe_scope, Address::DumpStyleResolvedDescription);
+ strm.IndentLess();
return true;
}
@@ -347,7 +350,7 @@
else
{
ConstString function_name(name);
- num_matches = symbol_vendor->FindFunctions(function_name, true, sc_list);
+ num_matches = symbol_vendor->FindFunctions(function_name, eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeMethod | eFunctionNameTypeSelector, true, sc_list);
}
if (num_matches)
diff --git a/source/Commands/CommandObjectThread.cpp b/source/Commands/CommandObjectThread.cpp
index bf4843d..0fd53fe 100644
--- a/source/Commands/CommandObjectThread.cpp
+++ b/source/Commands/CommandObjectThread.cpp
@@ -619,8 +619,8 @@
lldb::OptionDefinition
CommandObjectThreadStepWithTypeAndScope::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_1, true, "avoid_no_debug", 'a', required_argument, NULL, 0, "<avoid_no_debug>", "Should step-in step over functions with no debug information"},
-{ LLDB_OPT_SET_1, true, "run_mode", 'm', required_argument, g_tri_running_mode, 0, "<run_mode>", "Determine how to run other threads while stepping this one"},
+{ LLDB_OPT_SET_1, false, "avoid_no_debug", 'a', required_argument, NULL, 0, "<avoid_no_debug>", "Should step-in step over functions with no debug information"},
+{ LLDB_OPT_SET_1, false, "run_mode", 'm', required_argument, g_tri_running_mode, 0, "<run_mode>", "Determine how to run other threads while stepping this one"},
{ 0, false, NULL, 0, 0, NULL, 0, NULL, NULL }
};
@@ -1060,9 +1060,9 @@
lldb::OptionDefinition
CommandObjectThreadUntil::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_1, true, "frame", 'f', required_argument, NULL, 0, "<frame>", "Frame index for until operation - defaults to 0"},
-{ LLDB_OPT_SET_1, true, "thread", 't', required_argument, NULL, 0, "<thread>", "Thread index for the thread for until operation"},
-{ LLDB_OPT_SET_1, true, "run_mode", 'm', required_argument, g_duo_running_mode, 0, "<run_mode>", "Determine how to run other threads while stepping this one"},
+{ LLDB_OPT_SET_1, false, "frame", 'f', required_argument, NULL, 0, "<frame>", "Frame index for until operation - defaults to 0"},
+{ LLDB_OPT_SET_1, false, "thread", 't', required_argument, NULL, 0, "<thread>", "Thread index for the thread for until operation"},
+{ LLDB_OPT_SET_1, false, "run_mode",'m', required_argument, g_duo_running_mode, 0, "<run_mode>","Determine how to run other threads while stepping this one"},
{ 0, false, NULL, 0, 0, NULL, 0, NULL, NULL }
};
diff --git a/source/Core/Address.cpp b/source/Core/Address.cpp
index 034c8d8..f7e7500 100644
--- a/source/Core/Address.cpp
+++ b/source/Core/Address.cpp
@@ -629,7 +629,10 @@
{
// We have a function or a symbol from the same
// sections as this address.
+ s->Indent(" Summary: ");
sc.DumpStopContext(s, process, *this, false);
+ s->EOL();
+ sc.GetDescription(s, eDescriptionLevelBrief, process);
}
else
{
diff --git a/source/Core/AddressResolverName.cpp b/source/Core/AddressResolverName.cpp
index 9e154c6..490fc46 100644
--- a/source/Core/AddressResolverName.cpp
+++ b/source/Core/AddressResolverName.cpp
@@ -107,15 +107,24 @@
case AddressResolver::Exact:
if (context.module_sp)
{
- context.module_sp->FindSymbolsWithNameAndType (m_func_name, eSymbolTypeCode, sym_list);
- context.module_sp->FindFunctions (m_func_name, false, func_list);
+ context.module_sp->FindSymbolsWithNameAndType (m_func_name,
+ eSymbolTypeCode,
+ sym_list);
+ context.module_sp->FindFunctions (m_func_name,
+ eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeMethod | eFunctionNameTypeSelector,
+ false,
+ func_list);
}
break;
case AddressResolver::Regexp:
if (context.module_sp)
{
- context.module_sp->FindSymbolsMatchingRegExAndType (m_regex, eSymbolTypeCode, sym_list);
- context.module_sp->FindFunctions (m_regex, true, func_list);
+ context.module_sp->FindSymbolsMatchingRegExAndType (m_regex,
+ eSymbolTypeCode,
+ sym_list);
+ context.module_sp->FindFunctions (m_regex,
+ true,
+ func_list);
}
break;
case AddressResolver::Glob:
diff --git a/source/Core/Module.cpp b/source/Core/Module.cpp
index c8e7d2f..3d0b982 100644
--- a/source/Core/Module.cpp
+++ b/source/Core/Module.cpp
@@ -286,11 +286,11 @@
}
uint32_t
-Module::FindFunctions(const ConstString &name, bool append, SymbolContextList& sc_list)
+Module::FindFunctions(const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list)
{
SymbolVendor *symbols = GetSymbolVendor ();
if (symbols)
- return symbols->FindFunctions(name, append, sc_list);
+ return symbols->FindFunctions(name, name_type_mask, append, sc_list);
return 0;
}
diff --git a/source/Core/ModuleList.cpp b/source/Core/ModuleList.cpp
index ae6e27b..c928508 100644
--- a/source/Core/ModuleList.cpp
+++ b/source/Core/ModuleList.cpp
@@ -126,14 +126,14 @@
}
size_t
-ModuleList::FindFunctions (const ConstString &name, SymbolContextList &sc_list)
+ModuleList::FindFunctions (const ConstString &name, uint32_t name_type_mask, SymbolContextList &sc_list)
{
sc_list.Clear();
Mutex::Locker locker(m_modules_mutex);
collection::const_iterator pos, end = m_modules.end();
for (pos = m_modules.begin(); pos != end; ++pos)
{
- (*pos)->FindFunctions (name, true, sc_list);
+ (*pos)->FindFunctions (name, name_type_mask, true, sc_list);
}
return sc_list.GetSize();
}
diff --git a/source/Core/SearchFilter.cpp b/source/Core/SearchFilter.cpp
index 4c54a91..b08f4d8 100644
--- a/source/Core/SearchFilter.cpp
+++ b/source/Core/SearchFilter.cpp
@@ -113,7 +113,6 @@
void
SearchFilter::GetDescription (Stream *s)
{
- s->PutCString("No Filter");
}
void
@@ -415,7 +414,7 @@
void
SearchFilterByModule::GetDescription (Stream *s)
{
- s->PutCString("In module ");
+ s->PutCString(", module = ");
if (s->GetVerbose())
{
char buffer[2048];
diff --git a/source/Core/VMRange.cpp b/source/Core/VMRange.cpp
index 29a699d..44b9975 100644
--- a/source/Core/VMRange.cpp
+++ b/source/Core/VMRange.cpp
@@ -42,9 +42,9 @@
void
-VMRange::Dump(Stream *s, lldb::addr_t offset) const
+VMRange::Dump(Stream *s, lldb::addr_t offset, uint32_t addr_width) const
{
- s->AddressRange(offset + GetBaseAddress(), offset + GetEndAddress(), sizeof (addr_t));
+ s->AddressRange(offset + GetBaseAddress(), offset + GetEndAddress(), addr_width);
}
bool
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp b/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
index e7f92c6..54cbf42 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -14,6 +14,7 @@
#include "DWARFDebugAbbrev.h"
#include "DWARFDebugAranges.h"
+#include "DWARFDebugInfo.h"
#include "DWARFDIECollection.h"
#include "DWARFFormValue.h"
#include "LogChannelDWARF.h"
@@ -549,13 +550,14 @@
void
DWARFCompileUnit::Index
(
- lldb_private::UniqueCStringMap<dw_offset_t>& name_to_function_die,
- lldb_private::UniqueCStringMap<dw_offset_t>& name_to_inlined_die,
- lldb_private::UniqueCStringMap<dw_offset_t>& name_to_global_die,
- lldb_private::UniqueCStringMap<dw_offset_t>& name_to_type_die
+ lldb_private::UniqueCStringMap<dw_offset_t>& base_name_to_function_die,
+ lldb_private::UniqueCStringMap<dw_offset_t>& full_name_to_function_die,
+ lldb_private::UniqueCStringMap<dw_offset_t>& method_name_to_function_die,
+ lldb_private::UniqueCStringMap<dw_offset_t>& selector_name_to_function_die,
+ lldb_private::UniqueCStringMap<dw_offset_t>& name_to_type_die,
+ lldb_private::UniqueCStringMap<dw_offset_t>& name_to_global_die
)
{
-
const DataExtractor* debug_str = &m_dwarf2Data->get_debug_str_data();
DWARFDebugInfoEntry::const_iterator pos;
@@ -597,6 +599,7 @@
bool has_address = false;
bool has_location = false;
bool is_global_or_static_variable = false;
+ dw_offset_t specification_die_offset = DW_INVALID_OFFSET;
const size_t num_attributes = die.GetAttributes(m_dwarf2Data, this, attributes);
if (num_attributes > 0)
{
@@ -685,6 +688,11 @@
}
}
break;
+
+ case DW_AT_specification:
+ if (attributes.ExtractFormValueAtIndex(m_dwarf2Data, i, form_value))
+ specification_die_offset = form_value.Reference(this);
+ break;
}
}
}
@@ -694,7 +702,7 @@
case DW_TAG_subprogram:
if (has_address)
{
- if (name && name[0])
+ if (name)
{
if ((name[0] == '-' || name[0] == '+') && name[1] == '[')
{
@@ -716,24 +724,58 @@
// accelerator tables
size_t method_name_len = name_len - (method_name - name) - 1;
ConstString method_const_str (method_name, method_name_len);
- name_to_function_die.Append(method_const_str.AsCString(), die.GetOffset());
+ selector_name_to_function_die.Append(method_const_str.AsCString(), die.GetOffset());
}
}
}
- name_to_function_die.Append(ConstString(name).AsCString(), die.GetOffset());
+ // If we have a mangled name, then the DW_AT_name attribute
+ // is usually the method name without the class or any parameters
+ const DWARFDebugInfoEntry *parent = die.GetParent();
+ bool is_method = false;
+ if (parent)
+ {
+ dw_tag_t tag = parent->Tag();
+ if (tag == DW_TAG_class_type || tag == DW_TAG_structure_type)
+ {
+ is_method = true;
+ }
+ else
+ {
+ if (mangled && specification_die_offset != DW_INVALID_OFFSET)
+ {
+ const DWARFDebugInfoEntry *specification_die = m_dwarf2Data->DebugInfo()->GetDIEPtr (specification_die_offset, NULL);
+ if (specification_die)
+ {
+ parent = specification_die->GetParent();
+ if (parent)
+ {
+ tag = parent->Tag();
+
+ if (tag == DW_TAG_class_type || tag == DW_TAG_structure_type)
+ is_method = true;
+ }
+ }
+ }
+ }
+ }
+
+ if (is_method)
+ method_name_to_function_die.Append(ConstString(name).AsCString(), die.GetOffset());
+ else
+ base_name_to_function_die.Append(ConstString(name).AsCString(), die.GetOffset());
}
- if (mangled && mangled[0])
- name_to_function_die.Append(ConstString(mangled).AsCString(), die.GetOffset());
+ if (mangled)
+ full_name_to_function_die.Append(ConstString(mangled).AsCString(), die.GetOffset());
}
break;
case DW_TAG_inlined_subroutine:
if (has_address)
{
- if (name && name[0])
- name_to_inlined_die.Append(ConstString(name).AsCString(), die.GetOffset());
- if (mangled && mangled[0])
- name_to_inlined_die.Append(ConstString(mangled).AsCString(), die.GetOffset());
+ if (name)
+ base_name_to_function_die.Append(ConstString(name).AsCString(), die.GetOffset());
+ if (mangled)
+ full_name_to_function_die.Append(ConstString(mangled).AsCString(), die.GetOffset());
}
break;
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h b/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
index 44bbbfe..d269537 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
+++ b/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
@@ -142,10 +142,13 @@
}
void
- Index (lldb_private::UniqueCStringMap<dw_offset_t>& name_to_function_die,
- lldb_private::UniqueCStringMap<dw_offset_t>& name_to_inlined_die,
- lldb_private::UniqueCStringMap<dw_offset_t>& name_to_global_die,
- lldb_private::UniqueCStringMap<dw_offset_t>& name_to_type_die);
+ Index (lldb_private::UniqueCStringMap<dw_offset_t>& base_name_to_function_die,
+ lldb_private::UniqueCStringMap<dw_offset_t>& full_name_to_function_die,
+ lldb_private::UniqueCStringMap<dw_offset_t>& method_name_to_function_die,
+ lldb_private::UniqueCStringMap<dw_offset_t>& selector_name_to_function_die,
+ lldb_private::UniqueCStringMap<dw_offset_t>& name_to_type_die,
+ lldb_private::UniqueCStringMap<dw_offset_t>& name_to_global_die);
+
protected:
SymbolFileDWARF* m_dwarf2Data;
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 27b0aa2..67e4dfc 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -229,8 +229,10 @@
m_aranges(),
m_info(),
m_line(),
- m_name_to_function_die(),
- m_name_to_inlined_die(),
+ m_base_name_to_function_die(),
+ m_full_name_to_function_die(),
+ m_method_name_to_function_die(),
+ m_selector_name_to_function_die(),
m_name_to_global_die(),
m_name_to_type_die(),
m_indexed(false),
@@ -1778,8 +1780,10 @@
bool clear_dies = cu->ExtractDIEsIfNeeded (false) > 1;
- cu->Index (m_name_to_function_die,
- m_name_to_inlined_die,
+ cu->Index (m_base_name_to_function_die,
+ m_full_name_to_function_die,
+ m_method_name_to_function_die,
+ m_selector_name_to_function_die,
m_name_to_global_die,
m_name_to_type_die);
@@ -1789,8 +1793,10 @@
cu->ClearDIEs (true);
}
- m_name_to_function_die.Sort();
- m_name_to_inlined_die.Sort();
+ m_base_name_to_function_die.Sort();
+ m_full_name_to_function_die.Sort();
+ m_method_name_to_function_die.Sort();
+ m_selector_name_to_function_die.Sort();
m_name_to_global_die.Sort();
m_name_to_type_die.Sort();
}
@@ -1893,33 +1899,20 @@
}
-uint32_t
-SymbolFileDWARF::FindFunctions(const ConstString &name, bool append, SymbolContextList& sc_list)
+void
+SymbolFileDWARF::FindFunctions
+(
+ const ConstString &name,
+ UniqueCStringMap<dw_offset_t> &name_to_die,
+ SymbolContextList& sc_list
+)
{
- Timer scoped_timer (__PRETTY_FUNCTION__,
- "SymbolFileDWARF::FindFunctions (name = '%s')",
- name.AsCString());
-
- std::vector<dw_offset_t> die_offsets;
-
- // If we aren't appending the results to this list, then clear the list
- if (!append)
- sc_list.Clear();
-
- // Remember how many sc_list are in the list before we search in case
- // we are appending the results to a variable list.
- uint32_t original_size = sc_list.GetSize();
-
- // Index the DWARF if we haven't already
- if (!m_indexed)
- Index ();
-
const UniqueCStringMap<dw_offset_t>::Entry *entry;
SymbolContext sc;
- for (entry = m_name_to_function_die.FindFirstValueForName (name.AsCString());
+ for (entry = name_to_die.FindFirstValueForName (name.AsCString());
entry != NULL;
- entry = m_name_to_function_die.FindNextValueForName (name.AsCString(), entry))
+ entry = name_to_die.FindNextValueForName (name.AsCString(), entry))
{
DWARFCompileUnitSP cu_sp;
const DWARFDebugInfoEntry* die = DebugInfo()->GetDIEPtr (entry->value, &cu_sp);
@@ -1943,6 +1936,47 @@
}
}
+}
+
+uint32_t
+SymbolFileDWARF::FindFunctions
+(
+ const ConstString &name,
+ uint32_t name_type_mask,
+ bool append,
+ SymbolContextList& sc_list
+)
+{
+ Timer scoped_timer (__PRETTY_FUNCTION__,
+ "SymbolFileDWARF::FindFunctions (name = '%s')",
+ name.AsCString());
+
+ std::vector<dw_offset_t> die_offsets;
+
+ // If we aren't appending the results to this list, then clear the list
+ if (!append)
+ sc_list.Clear();
+
+ // Remember how many sc_list are in the list before we search in case
+ // we are appending the results to a variable list.
+ uint32_t original_size = sc_list.GetSize();
+
+ // Index the DWARF if we haven't already
+ if (!m_indexed)
+ Index ();
+
+ if (name_type_mask & eFunctionNameTypeBase)
+ FindFunctions (name, m_base_name_to_function_die, sc_list);
+
+ if (name_type_mask & eFunctionNameTypeFull)
+ FindFunctions (name, m_full_name_to_function_die, sc_list);
+
+ if (name_type_mask & eFunctionNameTypeMethod)
+ FindFunctions (name, m_method_name_to_function_die, sc_list);
+
+ if (name_type_mask & eFunctionNameTypeSelector)
+ FindFunctions (name, m_selector_name_to_function_die, sc_list);
+
// Return the number of variable that were appended to the list
return sc_list.GetSize() - original_size;
}
@@ -1971,14 +2005,14 @@
// Create the pubnames information so we can quickly lookup external symbols by name
// Create the pubnames information so we can quickly lookup external symbols by name
- const size_t num_entries = m_name_to_function_die.GetSize();
+ const size_t num_entries = m_full_name_to_function_die.GetSize();
SymbolContext sc;
for (size_t i=0; i<num_entries; i++)
{
- if (!regex.Execute(m_name_to_function_die.GetCStringAtIndex (i)))
+ if (!regex.Execute(m_full_name_to_function_die.GetCStringAtIndex (i)))
continue;
- const dw_offset_t die_offset = *m_name_to_function_die.GetValueAtIndex (i);
+ const dw_offset_t die_offset = *m_full_name_to_function_die.GetValueAtIndex (i);
DWARFCompileUnitSP cu_sp;
const DWARFDebugInfoEntry* die = DebugInfo()->GetDIEPtr (die_offset, &cu_sp);
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 95545a4..c2ad972 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -97,7 +97,7 @@
virtual uint32_t ResolveSymbolContext (const lldb_private::FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, lldb_private::SymbolContextList& sc_list);
virtual uint32_t FindGlobalVariables(const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::VariableList& variables);
virtual uint32_t FindGlobalVariables(const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::VariableList& variables);
- virtual uint32_t FindFunctions(const lldb_private::ConstString &name, bool append, lldb_private::SymbolContextList& sc_list);
+ virtual uint32_t FindFunctions(const lldb_private::ConstString &name, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list);
virtual uint32_t FindFunctions(const lldb_private::RegularExpression& regex, bool append, lldb_private::SymbolContextList& sc_list);
// virtual uint32_t FindTypes(const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb::Type::Encoding encoding, lldb::user_id_t udt_uid, lldb_private::TypeList& types);
// virtual uint32_t FindTypes(const lldb_private::SymbolContext& sc, const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb::Type::Encoding encoding, lldb::user_id_t udt_uid, lldb_private::TypeList& types);
@@ -277,6 +277,11 @@
uint32_t& byte_stride,
uint32_t& bit_stride);
+ void FindFunctions(
+ const lldb_private::ConstString &name,
+ lldb_private::UniqueCStringMap<dw_offset_t> &name_to_die,
+ lldb_private::SymbolContextList& sc_list);
+
lldb_private::Type* GetUniquedTypeForDIEOffset(dw_offset_t type_die_offset, lldb::TypeSP& owning_type_sp, int32_t child_type, uint32_t idx, bool safe);
lldb::TypeSP GetTypeForDIE(DWARFCompileUnit *cu, const DWARFDebugInfoEntry* die, lldb::TypeSP& owning_type_sp, int32_t child_type, uint32_t idx);
// uint32_t FindTypes(std::vector<dw_offset_t> die_offsets, uint32_t max_matches, Type::Encoding encoding, lldb::user_id_t udt_uid, TypeList& types);
@@ -303,8 +308,10 @@
std::auto_ptr<DWARFDebugAranges> m_aranges;
std::auto_ptr<DWARFDebugInfo> m_info;
std::auto_ptr<DWARFDebugLine> m_line;
- lldb_private::UniqueCStringMap<dw_offset_t> m_name_to_function_die; // All concrete functions
- lldb_private::UniqueCStringMap<dw_offset_t> m_name_to_inlined_die; // All inlined functions
+ lldb_private::UniqueCStringMap<dw_offset_t> m_base_name_to_function_die; // All concrete functions
+ lldb_private::UniqueCStringMap<dw_offset_t> m_full_name_to_function_die; // All concrete functions
+ lldb_private::UniqueCStringMap<dw_offset_t> m_method_name_to_function_die; // All inlined functions
+ lldb_private::UniqueCStringMap<dw_offset_t> m_selector_name_to_function_die; // All method names for functions of classes
lldb_private::UniqueCStringMap<dw_offset_t> m_name_to_global_die; // Global and static variables
lldb_private::UniqueCStringMap<dw_offset_t> m_name_to_type_die; // All type DIE offsets
bool m_indexed;
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 7bf968d..9da672f 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -763,7 +763,7 @@
}
uint32_t
-SymbolFileDWARFDebugMap::FindFunctions(const ConstString &name, bool append, SymbolContextList& sc_list)
+SymbolFileDWARFDebugMap::FindFunctions(const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list)
{
Timer scoped_timer (__PRETTY_FUNCTION__,
"SymbolFileDWARFDebugMap::FindFunctions (name = %s)",
@@ -788,7 +788,7 @@
{
SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex (oso_idx);
if (oso_dwarf)
- oso_dwarf->FindFunctions(name, true, sc_list);
+ oso_dwarf->FindFunctions(name, name_type_mask, true, sc_list);
}
}
// Stream s(stdout);
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
index 0a312ab..d5e2b51 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
@@ -64,7 +64,7 @@
virtual uint32_t ResolveSymbolContext (const lldb_private::FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, lldb_private::SymbolContextList& sc_list);
virtual uint32_t FindGlobalVariables (const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::VariableList& variables);
virtual uint32_t FindGlobalVariables (const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::VariableList& variables);
- virtual uint32_t FindFunctions (const lldb_private::ConstString &name, bool append, lldb_private::SymbolContextList& sc_list);
+ virtual uint32_t FindFunctions (const lldb_private::ConstString &name, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list);
virtual uint32_t FindFunctions (const lldb_private::RegularExpression& regex, bool append, lldb_private::SymbolContextList& sc_list);
// virtual uint32_t FindTypes (const lldb_private::SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, Type::Encoding encoding, lldb::user_id_t udt_uid, TypeList& types);
// virtual uint32_t FindTypes (const lldb_private::SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, Type::Encoding encoding, lldb::user_id_t udt_uid, TypeList& types);
diff --git a/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
index d7da356..ff7b8bf 100644
--- a/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
+++ b/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
@@ -308,7 +308,7 @@
}
uint32_t
-SymbolFileSymtab::FindFunctions(const ConstString &name, bool append, SymbolContextList& sc_list)
+SymbolFileSymtab::FindFunctions(const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list)
{
Timer scoped_timer (__PRETTY_FUNCTION__,
"SymbolFileSymtab::FindFunctions (name = '%s')",
diff --git a/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h b/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
index ac73f29..e3eeb29 100644
--- a/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
+++ b/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
@@ -87,7 +87,7 @@
FindGlobalVariables(const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::VariableList& variables);
virtual uint32_t
- FindFunctions(const lldb_private::ConstString &name, bool append, lldb_private::SymbolContextList& sc_list);
+ FindFunctions(const lldb_private::ConstString &name, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list);
virtual uint32_t
FindFunctions(const lldb_private::RegularExpression& regex, bool append, lldb_private::SymbolContextList& sc_list);
diff --git a/source/Symbol/Block.cpp b/source/Symbol/Block.cpp
index 3214119..ab998cb 100644
--- a/source/Symbol/Block.cpp
+++ b/source/Symbol/Block.cpp
@@ -57,6 +57,30 @@
}
void
+Block::GetDescription(Stream *s, lldb::DescriptionLevel level, Process *process) const
+{
+ size_t num_ranges = m_ranges.size();
+ if (num_ranges)
+ {
+
+ addr_t base_addr = LLDB_INVALID_ADDRESS;
+ if (process)
+ base_addr = m_block_list->GetAddressRange().GetBaseAddress().GetLoadAddress(process);
+ if (base_addr == LLDB_INVALID_ADDRESS)
+ base_addr = m_block_list->GetAddressRange().GetBaseAddress().GetFileAddress();
+
+ s->Printf("range%s = ", num_ranges > 1 ? "s" : "");
+ std::vector<VMRange>::const_iterator pos, end = m_ranges.end();
+ for (pos = m_ranges.begin(); pos != end; ++pos)
+ pos->Dump(s, base_addr, 4);
+ }
+ *s << ", id = " << ((const UserID&)*this);
+
+ if (m_inlineInfoSP.get() != NULL)
+ m_inlineInfoSP->Dump(s);
+}
+
+void
Block::Dump(Stream *s, addr_t base_addr, int32_t depth, bool show_context) const
{
if (depth < 0)
@@ -69,12 +93,10 @@
s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
s->Indent();
*s << "Block" << ((const UserID&)*this);
- user_id_t parentID = GetParentUID();
- const Block* parent_block = NULL;
- if (parentID != Block::InvalidID)
+ const Block* parent_block = GetParent();
+ if (parent_block)
{
- parent_block = m_block_list->GetBlockByID(parentID);
- s->Printf(", parent = {0x%8.8x}", parentID);
+ s->Printf(", parent = {0x%8.8x}", parent_block->GetID());
}
if (m_inlineInfoSP.get() != NULL)
m_inlineInfoSP->Dump(s);
@@ -128,10 +150,7 @@
void
Block::DumpStopContext (Stream *s, const SymbolContext *sc)
{
- user_id_t parentID = GetParentUID();
- Block* parent_block = NULL;
- if (parentID != Block::InvalidID)
- parent_block = m_block_list->GetBlockByID(parentID);
+ Block* parent_block = GetParent();
InlineFunctionInfo* inline_info = InlinedFunctionInfo ();
if (inline_info)
@@ -256,6 +275,24 @@
}
+Block *
+Block::GetParent () const
+{
+ return m_block_list->GetBlockByID (m_block_list->GetParent(GetID()));
+}
+
+Block *
+Block::GetSibling () const
+{
+ return m_block_list->GetBlockByID (m_block_list->GetSibling(GetID()));
+}
+
+Block *
+Block::GetFirstChild () const
+{
+ return m_block_list->GetBlockByID (m_block_list->GetFirstChild(GetID()));
+}
+
user_id_t
Block::GetParentUID() const
{
@@ -455,7 +492,7 @@
const Block *
BlockList::GetBlockByID(user_id_t blockID) const
{
- if (m_blocks.empty())
+ if (m_blocks.empty() || blockID == Block::InvalidID)
return NULL;
if (blockID == Block::RootID)
@@ -471,7 +508,7 @@
Block *
BlockList::GetBlockByID(user_id_t blockID)
{
- if (m_blocks.empty())
+ if (m_blocks.empty() || blockID == Block::InvalidID)
return NULL;
if (blockID == Block::RootID)
@@ -584,16 +621,13 @@
if (get_child_variables)
{
- user_id_t block_id = GetFirstChildUID();
- while (block_id != Block::InvalidID)
+ Block *child_block = GetFirstChild();
+ while (child_block)
{
- Block *child_block = m_block_list->GetBlockByID(block_id);
- assert(child_block);
VariableListSP child_block_variable_list(child_block->GetVariableList(get_child_variables, can_create));
if (child_block_variable_list.get())
variable_list_sp->AddVariables(child_block_variable_list.get());
-
- block_id = child_block->GetSiblingUID();
+ child_block = child_block->GetSibling();
}
}
}
@@ -615,13 +649,9 @@
if (get_parent_variables)
{
- user_id_t parentID = GetParentUID();
- if (parentID != Block::InvalidID)
- {
- Block* parent_block = m_block_list->GetBlockByID(parentID);
- if (parent_block)
- num_variables_added += parent_block->AppendVariables (can_create, get_parent_variables, variable_list);
- }
+ Block* parent_block = GetParent();
+ if (parent_block)
+ num_variables_added += parent_block->AppendVariables (can_create, get_parent_variables, variable_list);
}
return num_variables_added;
}
diff --git a/source/Symbol/CompileUnit.cpp b/source/Symbol/CompileUnit.cpp
index 60a893b..7c60c1b 100644
--- a/source/Symbol/CompileUnit.cpp
+++ b/source/Symbol/CompileUnit.cpp
@@ -65,6 +65,13 @@
}
+void
+CompileUnit::GetDescription(Stream *s, lldb::DescriptionLevel level) const
+{
+ *s << '"' << (const FileSpec&)*this << "\", id = " << (const UserID&)*this
+ << ", language = " << (const Language&)*this;
+}
+
//----------------------------------------------------------------------
// Dump the current contents of this object. No functions that cause on
diff --git a/source/Symbol/Declaration.cpp b/source/Symbol/Declaration.cpp
index a31a304..d53d900 100644
--- a/source/Symbol/Declaration.cpp
+++ b/source/Symbol/Declaration.cpp
@@ -61,12 +61,11 @@
{
if (m_file)
{
- *s << ", decl = '" << m_file;
+ *s << ", decl = " << m_file;
if (m_line > 0)
s->Printf(":%u", m_line);
if (m_column > 0)
s->Printf(":%u", m_column);
- s->PutChar('\'');
}
else
{
diff --git a/source/Symbol/Function.cpp b/source/Symbol/Function.cpp
index 51c449a..57f6cb4 100644
--- a/source/Symbol/Function.cpp
+++ b/source/Symbol/Function.cpp
@@ -261,6 +261,16 @@
return m_comp_unit;
}
+
+void
+Function::GetDescription(Stream *s, lldb::DescriptionLevel level, Process *process)
+{
+ Type* func_type = GetType();
+ *s << '"' << func_type->GetName() << "\", id = " << (const UserID&)*this;
+ *s << ", range = ";
+ GetAddressRange().Dump(s, process, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress);
+}
+
void
Function::Dump(Stream *s, bool show_context) const
{
diff --git a/source/Symbol/LineEntry.cpp b/source/Symbol/LineEntry.cpp
index cdc3c54..fb362b9 100644
--- a/source/Symbol/LineEntry.cpp
+++ b/source/Symbol/LineEntry.cpp
@@ -118,14 +118,12 @@
fallback_style))
return false;
}
+ if (show_file)
+ *s << ", file = " << file;
if (line)
s->Printf(", line = %u", line);
if (column)
s->Printf(", column = %u", column);
- if (show_file)
- {
- *s << ", file = " << file;
- }
if (is_start_of_statement)
*s << ", is_start_of_statement = TRUE";
@@ -144,13 +142,22 @@
}
bool
-LineEntry::GetDescription (Stream *s, lldb::DescriptionLevel level, CompileUnit* cu, Process *process) const
+LineEntry::GetDescription (Stream *s, lldb::DescriptionLevel level, CompileUnit* cu, Process *process, bool show_address_only) const
{
if (level == lldb::eDescriptionLevelBrief || level == lldb::eDescriptionLevelFull)
{
// Show address only
- range.GetBaseAddress().Dump(s, process, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
+ if (show_address_only)
+ {
+ s->PutCString ("address = ");
+ range.GetBaseAddress().Dump(s, process, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
+ }
+ else
+ {
+ s->PutCString ("range = ");
+ range.Dump(s, process, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
+ }
if (file)
*s << ' ' << file;
diff --git a/source/Symbol/LineTable.cpp b/source/Symbol/LineTable.cpp
index 0539335..cd83665 100644
--- a/source/Symbol/LineTable.cpp
+++ b/source/Symbol/LineTable.cpp
@@ -324,7 +324,7 @@
for (size_t idx = 0; idx < count; ++idx)
{
ConvertEntryAtIndexToLineEntry (idx, line_entry);
- line_entry.GetDescription (s, level, m_comp_unit, process);
+ line_entry.GetDescription (s, level, m_comp_unit, process, true);
s->EOL();
}
}
diff --git a/source/Symbol/Symbol.cpp b/source/Symbol/Symbol.cpp
index fd3e4af..6c91dd4 100644
--- a/source/Symbol/Symbol.cpp
+++ b/source/Symbol/Symbol.cpp
@@ -168,6 +168,26 @@
}
void
+Symbol::GetDescription (Stream *s, lldb::DescriptionLevel level, Process *process) const
+{
+ *s << '"' << m_mangled.GetName() << "\", id = " << (const UserID&)*this;
+ const Section *section = m_addr_range.GetBaseAddress().GetSection();
+ if (section != NULL)
+ {
+ if (m_addr_range.GetByteSize() > 0)
+ {
+ s->PutCString(", range = ");
+ m_addr_range.Dump(s, process, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress);
+ }
+ else
+ {
+ s->PutCString(", address = ");
+ m_addr_range.GetBaseAddress().Dump(s, process, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress);
+ }
+ }
+}
+
+void
Symbol::Dump(Stream *s, Process *process, uint32_t index) const
{
// s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
diff --git a/source/Symbol/SymbolContext.cpp b/source/Symbol/SymbolContext.cpp
index 0a33d5a..eca278e 100644
--- a/source/Symbol/SymbolContext.cpp
+++ b/source/Symbol/SymbolContext.cpp
@@ -8,12 +8,13 @@
//===----------------------------------------------------------------------===//
#include "lldb/Symbol/SymbolContext.h"
-#include "lldb/Symbol/CompileUnit.h"
+
#include "lldb/Core/Module.h"
+#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Symbol.h"
-#include "lldb/Target/Target.h"
#include "lldb/Symbol/SymbolVendor.h"
+#include "lldb/Target/Target.h"
using namespace lldb;
using namespace lldb_private;
@@ -169,6 +170,81 @@
}
void
+SymbolContext::GetDescription(Stream *s, lldb::DescriptionLevel level, Process *process) const
+{
+ if (module_sp)
+ {
+ s->Indent(" Module: \"");
+ module_sp->GetFileSpec().Dump(s);
+ s->PutChar('"');
+ s->EOL();
+ }
+
+ if (comp_unit != NULL)
+ {
+ s->Indent("CompileUnit: ");
+ comp_unit->GetDescription (s, level);
+ s->EOL();
+ }
+
+ if (function != NULL)
+ {
+ s->Indent(" Function: ");
+ function->GetDescription (s, level, process);
+ s->EOL();
+
+ Type *func_type = function->GetType();
+ if (func_type)
+ {
+ s->Indent(" FuncType: ");
+ func_type->GetDescription (s, level, false);
+ s->EOL();
+ }
+ }
+
+ if (block != NULL)
+ {
+ std::vector<Block *> blocks;
+ blocks.push_back (block);
+ Block *parent_block = block->GetParent();
+
+ while (parent_block)
+ {
+ blocks.push_back (parent_block);
+ parent_block = parent_block->GetParent();
+ }
+ std::vector<Block *>::reverse_iterator pos;
+ std::vector<Block *>::reverse_iterator begin = blocks.rbegin();
+ std::vector<Block *>::reverse_iterator end = blocks.rend();
+ for (pos = begin; pos != end; ++pos)
+ {
+ if (pos == begin)
+ s->Indent(" Blocks: ");
+ else
+ s->Indent(" ");
+ (*pos)->GetDescription(s, level, process);
+ s->EOL();
+ }
+ }
+
+ if (line_entry.IsValid())
+ {
+ s->Indent(" LineEntry: ");
+ line_entry.GetDescription (s, level, comp_unit, process, false);
+ s->EOL();
+ }
+
+ if (symbol != NULL)
+ {
+ s->Indent(" Symbol: ");
+ symbol->GetDescription(s, level, process);
+ s->EOL();
+ }
+}
+
+
+
+void
SymbolContext::Dump(Stream *s, Process *process) const
{
*s << (void *)this << ": ";
@@ -178,48 +254,45 @@
s->EOL();
s->IndentMore();
s->Indent();
- *s << "Module = " << (void *)module_sp.get() << ' ';
+ *s << "Module = " << (void *)module_sp.get() << ' ';
if (module_sp)
module_sp->GetFileSpec().Dump(s);
s->EOL();
s->Indent();
*s << "CompileUnit = " << (void *)comp_unit;
if (comp_unit != NULL)
- *s << " {" << comp_unit->GetID() << "} " << *(dynamic_cast<FileSpec*> (comp_unit));
+ *s << " {0x" << comp_unit->GetID() << "} " << *(dynamic_cast<FileSpec*> (comp_unit));
s->EOL();
s->Indent();
- *s << "Function = " << (void *)function;
+ *s << "Function = " << (void *)function;
if (function != NULL)
{
- *s << " {" << function->GetID() << "} ";/// << function->GetType()->GetName();
-// Type* func_type = function->Type();
-// if (func_type)
-// {
-// s->EOL();
-// const UserDefType* func_udt = func_type->GetUserDefinedType().get();
-// if (func_udt)
-// {
-// s->IndentMore();
-// func_udt->Dump(s, func_type);
-// s->IndentLess();
-// }
-// }
+ *s << " {0x" << function->GetID() << "} " << function->GetType()->GetName() << ", address-range = ";
+ function->GetAddressRange().Dump(s, process, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress);
+ s->EOL();
+ s->Indent();
+ Type* func_type = function->GetType();
+ if (func_type)
+ {
+ *s << " Type = ";
+ func_type->Dump (s, false);
+ }
}
s->EOL();
s->Indent();
- *s << "Block = " << (void *)block;
+ *s << "Block = " << (void *)block;
if (block != NULL)
- *s << " {" << block->GetID() << '}';
+ *s << " {0x" << block->GetID() << '}';
// Dump the block and pass it a negative depth to we print all the parent blocks
//if (block != NULL)
// block->Dump(s, function->GetFileAddress(), INT_MIN);
s->EOL();
s->Indent();
- *s << "LineEntry = ";
+ *s << "LineEntry = ";
line_entry.Dump (s, process, true, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress, true);
s->EOL();
s->Indent();
- *s << "Symbol = " << (void *)symbol;
+ *s << "Symbol = " << (void *)symbol;
if (symbol != NULL && symbol->GetMangled())
*s << ' ' << symbol->GetMangled().GetName().AsCString();
s->EOL();
@@ -313,7 +386,7 @@
if (module_sp != NULL)
{
SymbolContextList sc_matches;
- if (module_sp->FindFunctions (name_const_str, false, sc_matches) > 0)
+ if (module_sp->FindFunctions (name_const_str, eFunctionNameTypeBase | eFunctionNameTypeFull, false, sc_matches) > 0)
{
SymbolContext sc;
sc_matches.GetContextAtIndex (0, sc);
@@ -324,7 +397,7 @@
if (target_sp)
{
SymbolContextList sc_matches;
- if (target_sp->GetImages().FindFunctions (name_const_str, sc_matches) > 0)
+ if (target_sp->GetImages().FindFunctions (name_const_str, eFunctionNameTypeBase | eFunctionNameTypeFull, sc_matches) > 0)
{
SymbolContext sc;
sc_matches.GetContextAtIndex (0, sc);
diff --git a/source/Symbol/SymbolVendor.cpp b/source/Symbol/SymbolVendor.cpp
index 5fb8b0a..b4c4f83 100644
--- a/source/Symbol/SymbolVendor.cpp
+++ b/source/Symbol/SymbolVendor.cpp
@@ -234,11 +234,11 @@
}
uint32_t
-SymbolVendor::FindFunctions(const ConstString &name, bool append, SymbolContextList& sc_list)
+SymbolVendor::FindFunctions(const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list)
{
Mutex::Locker locker(m_mutex);
if (m_sym_file_ap.get())
- return m_sym_file_ap->FindFunctions(name, append, sc_list);
+ return m_sym_file_ap->FindFunctions(name, name_type_mask, append, sc_list);
return 0;
}
diff --git a/source/Symbol/Type.cpp b/source/Symbol/Type.cpp
index 9338ea2..4735d05 100644
--- a/source/Symbol/Type.cpp
+++ b/source/Symbol/Type.cpp
@@ -97,6 +97,81 @@
void
+lldb_private::Type::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_name)
+{
+ if (show_name)
+ {
+ if (m_name)
+ *s << '\"' << m_name << "\", ";
+ }
+
+ *s << "id = " << (const UserID&)*this;
+
+ if (m_byte_size != 0)
+ s->Printf(", byte-size = %zu", m_byte_size);
+
+ m_decl.Dump(s);
+
+ clang::QualType qual_type(clang::QualType::getFromOpaquePtr(m_clang_qual_type));
+
+ if (qual_type.getTypePtr())
+ {
+ *s << ", type = ";
+
+ clang::TagType *tag_type = dyn_cast<clang::TagType>(qual_type.getTypePtr());
+ clang::TagDecl *tag_decl = NULL;
+ if (tag_type)
+ tag_decl = tag_type->getDecl();
+
+ if (tag_decl)
+ {
+ s->EOL();
+ s->EOL();
+ tag_decl->print(llvm::fouts(), 0);
+ s->EOL();
+ }
+ else
+ {
+ const clang::TypedefType *typedef_type = qual_type->getAs<clang::TypedefType>();
+ if (typedef_type)
+ {
+ const clang::TypedefDecl *typedef_decl = typedef_type->getDecl();
+ std::string clang_typedef_name (typedef_decl->getQualifiedNameAsString());
+ if (!clang_typedef_name.empty())
+ *s << ' ' << clang_typedef_name.c_str();
+ }
+ else
+ {
+ // We have a clang type, lets show it
+ clang::ASTContext *ast_context = GetClangAST();
+ if (ast_context)
+ {
+ std::string clang_type_name(qual_type.getAsString());
+ if (!clang_type_name.empty())
+ *s << ' ' << clang_type_name.c_str();
+ }
+ }
+ }
+ }
+ else if (m_encoding_uid != LLDB_INVALID_UID)
+ {
+ *s << ", type_uid = " << m_encoding_uid;
+ switch (m_encoding_uid_type)
+ {
+ case eIsTypeWithUID: s->PutCString(" (unresolved type)"); break;
+ case eIsConstTypeWithUID: s->PutCString(" (unresolved const type)"); break;
+ case eIsRestrictTypeWithUID: s->PutCString(" (unresolved restrict type)"); break;
+ case eIsVolatileTypeWithUID: s->PutCString(" (unresolved volatile type)"); break;
+ case eTypedefToTypeWithUID: s->PutCString(" (unresolved typedef)"); break;
+ case ePointerToTypeWithUID: s->PutCString(" (unresolved pointer)"); break;
+ case eLValueReferenceToTypeWithUID: s->PutCString(" (unresolved L value reference)"); break;
+ case eRValueReferenceToTypeWithUID: s->PutCString(" (unresolved R value reference)"); break;
+ }
+ }
+}
+
+
+void
lldb_private::Type::Dump (Stream *s, bool show_context)
{
s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
@@ -148,16 +223,12 @@
else
{
// We have a clang type, lets show it
- TypeList *type_list = GetTypeList();
- if (type_list)
+ clang::ASTContext *ast_context = GetClangAST();
+ if (ast_context)
{
- clang::ASTContext *ast_context = GetClangAST();
- if (ast_context)
- {
- std::string clang_type_name(qual_type.getAsString());
- if (!clang_type_name.empty())
- *s << " (" << clang_type_name.c_str() << ')';
- }
+ std::string clang_type_name(qual_type.getAsString());
+ if (!clang_type_name.empty())
+ *s << " (" << clang_type_name.c_str() << ')';
}
}
}
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index 1ba125c..cba72e9 100644
--- a/source/Target/Target.cpp
+++ b/source/Target/Target.cpp
@@ -179,11 +179,16 @@
}
BreakpointSP
-Target::CreateBreakpoint (FileSpec *containingModule, const char *func_name, bool internal)
+Target::CreateBreakpoint (FileSpec *containingModule, const char *func_name, uint32_t func_name_type_mask, bool internal)
{
- SearchFilterSP filter_sp(GetSearchFilterForModule (containingModule));
- BreakpointResolverSP resolver_sp (new BreakpointResolverName (NULL, func_name));
- return CreateBreakpoint (filter_sp, resolver_sp, internal);
+ BreakpointSP bp_sp;
+ if (func_name)
+ {
+ SearchFilterSP filter_sp(GetSearchFilterForModule (containingModule));
+ BreakpointResolverSP resolver_sp (new BreakpointResolverName (NULL, func_name, func_name_type_mask, Breakpoint::Exact));
+ bp_sp = CreateBreakpoint (filter_sp, resolver_sp, internal);
+ }
+ return bp_sp;
}
diff --git a/tools/driver/Driver.cpp b/tools/driver/Driver.cpp
index 9d9281b..a77775a 100644
--- a/tools/driver/Driver.cpp
+++ b/tools/driver/Driver.cpp
@@ -49,13 +49,13 @@
static lldb::OptionDefinition g_options[] =
{
- { LLDB_OPT_SET_1, true, "help", 'h', no_argument, NULL, NULL, NULL,
+ { LLDB_OPT_SET_1, true, "help", 'h', no_argument, NULL, NULL, NULL,
"Prints out the usage information for the LLDB debugger." },
- { LLDB_OPT_SET_2, true, "version", 'v', no_argument, NULL, NULL, NULL,
+ { LLDB_OPT_SET_2, true, "version", 'v', no_argument, NULL, NULL, NULL,
"Prints out the current version number of the LLDB debugger." },
- { LLDB_OPT_SET_3, false, "arch", 'a', required_argument, NULL, NULL, "<architecture>",
+ { LLDB_OPT_SET_3, true, "arch", 'a', required_argument, NULL, NULL, "<architecture>",
"Tells the debugger to use the specified architecture when starting and running the program. <architecture> must be one of the architectures for which the program was compiled." },
{ LLDB_OPT_SET_3 | LLDB_OPT_SET_4, false, "script-language",'l', required_argument, NULL, NULL, "<scripting-language>",
@@ -67,11 +67,11 @@
{ LLDB_OPT_SET_3 | LLDB_OPT_SET_4, false, "source", 's', required_argument, NULL, NULL, "<file>",
"Tells the debugger to read in and execute the file <file>, which should contain lldb commands." },
- { LLDB_OPT_SET_3, false, "file", 'f', required_argument, NULL, NULL, "<filename>",
+ { LLDB_OPT_SET_3, true, "file", 'f', required_argument, NULL, NULL, "<filename>",
"Tells the debugger to use the file <filename> as the program to be debugged." },
- { LLDB_OPT_SET_4, false, "crash-log", 'c', required_argument, NULL, NULL, "<file>",
- "Load executable images from a crash log for symbolication." },
+// { LLDB_OPT_SET_4, true, "crash-log", 'c', required_argument, NULL, NULL, "<file>",
+// "Load executable images from a crash log for symbolication." },
{ 0, false, NULL, 0, 0, NULL, NULL, NULL, NULL }
};