Skip to content

Commit

Permalink
Decode
Browse files Browse the repository at this point in the history
Fixes in orbuculum decode files for instruction tracing.
  • Loading branch information
Lukas committed Oct 24, 2024
1 parent 4d168ac commit d2b0cb2
Show file tree
Hide file tree
Showing 4 changed files with 309 additions and 156 deletions.
8 changes: 5 additions & 3 deletions Inc/loadelf.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

#ifndef _LOADELF_H_
#define _LOADELF_H_

#include <stdbool.h>
#include <capstone/capstone.h>
Expand Down Expand Up @@ -42,6 +43,7 @@ struct symbolLineStore
struct symbolFunctionStore
{
char *funcname; /* What is the name of the function */
char *manglename; /* What is the manged name, if any */
unsigned int producer; /* What code/options produced it? */
unsigned int filename; /* What filename + path off the source root? */
unsigned int startline; /* Start line in source file of function */
Expand Down Expand Up @@ -87,7 +89,7 @@ struct symbol
csh caphandle;
};

enum instructionClass { LE_IC_NONE, LE_IC_JUMP = ( 1 << 0 ), LE_IC_4BYTE = ( 1 << 1 ), LE_IC_CALL = ( 1 << 2 ), LE_IC_IMMEDIATE = ( 1 << 3 ), LE_IC_IRET = ( 1 << 4 ) };
enum instructionClass { LE_IC_NONE, LE_IC_JUMP = ( 1 << 0 ), LE_IC_4BYTE = ( 1 << 1 ), LE_IC_CALL = ( 1 << 2 ), LE_IC_IMMEDIATE = ( 1 << 3 ), LE_IC_IRET = ( 1 << 4 ), LE_IC_SYNC_BARRIER = ( 1 << 5 ), LE_IC_COPROCESSOR = ( 1 << 6 )};

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

Expand Down Expand Up @@ -119,13 +121,13 @@ const char *symbolGetFilename( struct symbol *p, unsigned int index );
symbolMemptr symbolCodeAt( struct symbol *p, symbolMemaddr addr, unsigned int *len );

/* Return assembly code representing this line, with annotations */
char *symbolDisassembleLine( struct symbol *p, enum instructionClass *ic, symbolMemaddr addr, symbolMemaddr *newaddr );
char *symbolDisassembleLine( struct symbol *p, enum instructionClass *ic, symbolMemaddr addr, symbolMemaddr *newaddr);

/* Delete symbol set */
void symbolDelete( struct symbol *p );

/* Collect symbol set with specified components */
struct symbol *symbolAcquire( char *filename, bool loadlines, 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
7 changes: 6 additions & 1 deletion Inc/traceDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ enum TRACEchanges
EV_CH_VMID,
EV_CH_TSTAMP,
EV_CH_CYCLECOUNT,
EV_CH_ASYNC,
EV_CH_CONTEXTID,
EV_CH_TRIGGER,
EV_CH_SECURE,
Expand Down Expand Up @@ -143,6 +144,10 @@ struct TRACECPUState

// Convinience, for debug reporting
genericsReportCB report;

// Debugging
uint64_t overflows;
uint64_t ASyncs;
};

// ============================================================================
Expand All @@ -163,7 +168,7 @@ struct TRACEDecoderEngine
const char ( *name ) ( void );

/* Config specific to ETM3.5 */
void ( *altAddrEncode ) ( struct TRACEDecoderEngine *e, bool using );
void ( *altAddrEncode ) ( struct TRACEDecoderEngine *e, bool _using );
};

struct TRACEDecoder
Expand Down
Loading

0 comments on commit d2b0cb2

Please sign in to comment.