Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix symbolsAquire and add linkage name to get mangled C++ function names #140

Merged
merged 3 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Inc/loadelf.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ char *symbolDisassembleLine( struct symbol *p, enum instructionClass *ic, symbol
void symbolDelete( struct symbol *p );

/* Collect symbol set with specified components */
struct symbol *symbolAquire( char *filename, bool loadmem, bool loadsource );
struct symbol *symbolAcquire( char *filename, bool loadmem, bool loadsource );

/* Check if current symbols are valid */
bool symbolSetValid( struct symbol *p );
Expand Down
17 changes: 9 additions & 8 deletions Src/loadelf.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ static void _processFunctionDie( struct symbol *p, Dwarf_Debug dbg, Dwarf_Die di
char *name = NULL;
Dwarf_Addr h = 0;
Dwarf_Addr l = 0;
enum Dwarf_Form_Class formclass;
enum Dwarf_Form_Class formclass = DW_FORM_CLASS_UNKNOWN;

Dwarf_Attribute attr_data;
Dwarf_Half attr_tag;
Expand Down Expand Up @@ -384,7 +384,12 @@ static void _processFunctionDie( struct symbol *p, Dwarf_Debug dbg, Dwarf_Die di

specification_die = die;

if ( DW_DLV_OK != dwarf_diename( die, &name, 0 ) )
/* Get the possibly mangled linkage name if it exists */
if ( DW_DLV_OK == dwarf_attr( die, DW_AT_linkage_name, &attr_data, 0) )
{
dwarf_formstring( attr_data, &name, 0 );
}
else if ( DW_DLV_OK != dwarf_diename( die, &name, 0 ) )
{
/* Name will be hidden in a specification reference */
attr_tag = DW_AT_specification;
Expand Down Expand Up @@ -1102,7 +1107,7 @@ bool symbolSetValid( struct symbol *p )

// ====================================================================================================

struct symbol *symbolAquire( char *filename, bool loadmem, bool loadsource )
struct symbol *symbolAcquire( char *filename, bool loadmem, bool loadsource )

/* Collect symbol set with specified components */

Expand Down Expand Up @@ -1237,11 +1242,7 @@ void main( int argc, char *argv[] )

{
enum instructionClass ic;
<<<<<<< HEAD
struct symbol *p = symbolAcquire( argv[1], true, true, true );
=======
struct symbol *p = symbolAquire( argv[1], true, true );
>>>>>>> loadelf_fixup
struct symbol *p = symbolAcquire( argv[1], true, true );

if ( !p )
{
Expand Down
4 changes: 2 additions & 2 deletions Src/orbmortem.c
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ static bool _dumpBuffer( struct RunTime *r )
{
symbolDelete( r->s );

if ( !( r->s = symbolAquire( r->options->elffile, true, true ) ) )
if ( !( r->s = symbolAcquire( r->options->elffile, true, true ) ) )
{
genericsReport( V_ERROR, "Elf file or symbols in it not found" EOL );
return false;
Expand Down Expand Up @@ -1270,7 +1270,7 @@ int main( int argc, char *argv[] )
}

/* Check we've got _some_ symbols to start from */
_r.s = symbolAquire( _r.options->elffile, true, true );
_r.s = symbolAcquire( _r.options->elffile, true, true );

if ( !_r.s )
{
Expand Down
Loading