You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you load a ELF module that doesn't have Dwarf debug information, but does have exported public functions
(Like for example libpthread that you load when trying to analyze a core dump)
These functions are not considered when trying to look up a function name by instruction pointer.
But it works perfectly fine if you consider them.
I know this is not the proper way to do it, but I want to note it here in case someone who can do it properly comes along.
functionsCache.AddRange(publicSymbols.Where(x =>x.Type==SymbolType.Function&&x.Size!=0&&x.Address!=0).Where(x =>functionsCache.All(f =>f.GetConstantAttribute(DwarfAttribute.LowPc)!=x.Address)// #TODO binary search).Select(publicSymbol =>{Dictionary<DwarfAttribute,DwarfAttributeValue>attributes=newDictionary<DwarfAttribute,DwarfAttributeValue>();attributes.Add(DwarfAttribute.Name,newDwarfAttributeValue(){Type=DwarfAttributeValueType.String,Value=publicSymbol.Name});// LowPC is function startattributes.Add(DwarfAttribute.LowPc,newDwarfAttributeValue(){Type=DwarfAttributeValueType.Address,Value=publicSymbol.Address});// HighPc can either be address (end address) or constant (offset after start address, function size)attributes.Add(DwarfAttribute.HighPc,newDwarfAttributeValue(){Type=DwarfAttributeValueType.Constant,Value=publicSymbol.Size});attributes.Add(DwarfAttribute.ByteSize,newDwarfAttributeValue(){Type=DwarfAttributeValueType.Constant,Value=publicSymbol.Size});attributes.Add(DwarfAttribute.Type,newDwarfAttributeValue(){Type=DwarfAttributeValueType.Constant,Value=publicSymbol.Size});returnnewDwarfSymbol{Tag=DwarfTag.Subprogram,Attributes=attributes};}));
When you load a ELF module that doesn't have Dwarf debug information, but does have exported public functions
(Like for example libpthread that you load when trying to analyze a core dump)
These functions are not considered when trying to look up a function name by instruction pointer.
But it works perfectly fine if you consider them.
I know this is not the proper way to do it, but I want to note it here in case someone who can do it properly comes along.
Add
here https://github.com/southpolenator/SharpDebug/blob/next/Source/SharpDebug.DwarfSymbolProvider/IDwarfImage.cs#L39
and
here: https://github.com/southpolenator/SharpDebug/blob/next/Source/SharpDebug.DwarfSymbolProvider/ElfImage.cs#L60
and (this is the most hacky part)
here: https://github.com/southpolenator/SharpDebug/blob/next/Source/SharpDebug.DwarfSymbolProvider/DwarfSymbolProviderModule.cs#L1697
After these changes you will be able to resolve function names in libraries without debugging info.
The text was updated successfully, but these errors were encountered: