File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed
Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 44#include <dbg.h>
55#include <decode.h>
66#include <disasm.h>
7+ #include "ftrace.h"
78
9+ extern SymbolTable * sym_table ;
810extern LLVMDisasmContextRef disasm_ctx ;
911
1012static void cmd_help () {
@@ -43,6 +45,14 @@ static void cmd_step(int steps) {
4345 // Print the address and the disassembled instruction
4446 printf ("\33[1;34m=> 0x%016lx\33[1;0m: \t%s\n" , current_pc , asm_buf );
4547
48+ // Look up and print the function name if available
49+ if (sym_table ) {
50+ const FuncSymbol * func_symbol = find_func (sym_table , current_pc );
51+ if (func_symbol ) {
52+ printf ("\33[1;34m0x%08lx\33[1;0m in \33[1;33m%s\33[1;0m ()\n" , func_symbol -> address , func_symbol -> name );
53+ }
54+ }
55+
4656 // Execute the instruction
4757 exec_once ();
4858 }
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ int main(int argc, char *argv[]){
3131
3232 init_cpu ();
3333 if (argc > 2 && strcmp (argv [2 ], "--debug" ) == 0 ) {
34+ init_llvm_disassembler ();
3435 debug_loop ();
3536 }
3637 else if (argc > 2 && strcmp (argv [2 ], "--batch" ) == 0 ) {
Original file line number Diff line number Diff line change @@ -100,8 +100,6 @@ void load_elf_symbols(const char *file_path) {
100100 exit (1 );
101101 }
102102
103- printf ("Entry point: 0x%lx\n" , ehdr .e_entry );
104-
105103 Elf_Scn * scn = NULL ;
106104 GElf_Shdr shdr ;
107105 while ((scn = elf_nextscn (elf , scn )) != NULL ) {
You can’t perform that action at this time.
0 commit comments