<rdar://problem/10103468>

Symbol files (dSYM files on darwin) can now be specified during program execution:

(lldb) target symbols add /path/to/symfile/a.out.dSYM/Contents/Resources/DWARF/a.out

This command can be used when you have a debug session in progress and want to add symbols to get better debug info fidelity.

llvm-svn: 153693
This commit is contained in:
Greg Clayton 2012-03-29 21:43:25 +00:00
parent c13fd6d1e1
commit 12b834d626
4 changed files with 33 additions and 59 deletions

View File

@ -758,6 +758,8 @@ public:
SetSymbolFileFileSpec (const FileSpec &file)
{
m_symfile_spec = file;
m_symfile_ap.reset();
m_did_load_symbol_vendor = false;
}
const TimeValue &

View File

@ -250,21 +250,21 @@ namespace lldb {
//------------------------------------------------------------------
typedef enum SymbolContextItem
{
eSymbolContextTarget = (1 << 0), ///< Set when \a target is requested from a query, or was located in query results
eSymbolContextModule = (1 << 1), ///< Set when \a module is requested from a query, or was located in query results
eSymbolContextCompUnit = (1 << 2), ///< Set when \a comp_unit is requested from a query, or was located in query results
eSymbolContextFunction = (1 << 3), ///< Set when \a function is requested from a query, or was located in query results
eSymbolContextBlock = (1 << 4), ///< Set when the deepest \a block is requested from a query, or was located in query results
eSymbolContextLineEntry = (1 << 5), ///< Set when \a line_entry is requested from a query, or was located in query results
eSymbolContextSymbol = (1 << 6), ///< Set when \a symbol is requested from a query, or was located in query results
eSymbolContextEverything = ((eSymbolContextSymbol << 1) - 1) ///< Indicates to try and lookup everything up during a query.
eSymbolContextTarget = (1u << 0), ///< Set when \a target is requested from a query, or was located in query results
eSymbolContextModule = (1u << 1), ///< Set when \a module is requested from a query, or was located in query results
eSymbolContextCompUnit = (1u << 2), ///< Set when \a comp_unit is requested from a query, or was located in query results
eSymbolContextFunction = (1u << 3), ///< Set when \a function is requested from a query, or was located in query results
eSymbolContextBlock = (1u << 4), ///< Set when the deepest \a block is requested from a query, or was located in query results
eSymbolContextLineEntry = (1u << 5), ///< Set when \a line_entry is requested from a query, or was located in query results
eSymbolContextSymbol = (1u << 6), ///< Set when \a symbol is requested from a query, or was located in query results
eSymbolContextEverything = ((eSymbolContextSymbol << 1) - 1u) ///< Indicates to try and lookup everything up during a query.
} SymbolContextItem;
typedef enum Permissions
{
ePermissionsWritable = (1 << 0),
ePermissionsReadable = (1 << 1),
ePermissionsExecutable = (1 << 2)
ePermissionsWritable = (1u << 0),
ePermissionsReadable = (1u << 1),
ePermissionsExecutable = (1u << 2)
} Permissions;
typedef enum InputReaderAction

View File

@ -3559,55 +3559,16 @@ public:
ModuleSP old_module_sp (target->GetImages().FindModule (symfile_module_sp->GetUUID()));
if (old_module_sp)
{
const bool can_create = false;
if (old_module_sp->GetSymbolVendor (can_create))
{
// The current module already has a symbol file, so we need
// need to unload the existing references to this module,
// and reload with the new one.
ModuleSP target_exe_module_sp (target->GetExecutableModule());
const bool adding_symbols_to_executable = target_exe_module_sp.get() == old_module_sp.get();
ModuleSpec module_spec (old_module_sp->GetFileSpec(), old_module_sp->GetArchitecture());
module_spec.GetSymbolFileSpec() = symfile_spec;
// Unload the old module
ModuleList module_list;
module_list.Append (old_module_sp);
target->ModulesDidUnload (module_list);
// The module has not yet created its symbol vendor, we can just
// give the existing target module the symfile path to use for
// when it decides to create it!
old_module_sp->SetSymbolFileFileSpec (symfile_module_sp->GetFileSpec());
// Remove the module from the shared list
ModuleList::RemoveSharedModule (old_module_sp);
// Now create the new module and load it
module_list.Clear();
//ModuleSP new_module_sp (new Module (target_module_file, target_module_arch));
ModuleSP new_module_sp;
new_module_sp = target->GetSharedModule (module_spec);
if (new_module_sp)
{
new_module_sp->SetSymbolFileFileSpec (symfile_module_sp->GetFileSpec());
if (adding_symbols_to_executable)
{
bool get_dependent_files = true;
target->SetExecutableModule(new_module_sp, get_dependent_files);
}
else
{
module_list.Append (new_module_sp);
target->ModulesDidLoad(module_list);
}
}
}
else
{
// The module has not yet created its symbol vendor, we can just
// give the existing target module the symfile path to use for
// when it decides to create it!
old_module_sp->SetSymbolFileFileSpec (symfile_module_sp->GetFileSpec());
}
// Let clients know something changed in the module
// if it is currently loaded
ModuleList module_list;
module_list.Append (old_module_sp);
target->ModulesDidLoad (module_list);
}
}
else

View File

@ -2311,6 +2311,17 @@ SymbolFileDWARF::ResolveSymbolContext (const Address& so_addr, uint32_t resolve_
if (sc.function == NULL)
sc.function = ParseCompileUnitFunction(sc, curr_cu, function_die);
}
else
{
// We might have had a compile unit that had discontiguous
// address ranges where the gaps are symbols that don't have
// any debug info. Discontiguous compile unit address ranges
// should only happen when there aren't other functions from
// other compile units in these gaps. This helps keep the size
// of the aranges down.
sc.comp_unit = NULL;
resolved &= ~eSymbolContextCompUnit;
}
if (sc.function != NULL)
{