From 0c570ecb6a261e168bede8d0a0c9f93413a35472 Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Wed, 26 Jun 2013 18:07:01 +0000 Subject: [PATCH] clean symbols code a little --- bochs/bx_debug/dbg_main.cc | 5 ++-- bochs/bx_debug/debug.h | 1 - bochs/bx_debug/symbols.cc | 47 +++++++++++++------------------------- 3 files changed, 19 insertions(+), 34 deletions(-) diff --git a/bochs/bx_debug/dbg_main.cc b/bochs/bx_debug/dbg_main.cc index fb0e213ec..56ff1a656 100644 --- a/bochs/bx_debug/dbg_main.cc +++ b/bochs/bx_debug/dbg_main.cc @@ -1944,8 +1944,9 @@ void bx_dbg_disassemble_current(int which_cpu, int print_time) dbg_printf("[0x"FMT_PHY_ADDRX"] %04x:%04x (%s): ", phy, BX_CPU(which_cpu)->guard_found.cs, (unsigned) BX_CPU(which_cpu)->guard_found.eip, - bx_dbg_symbolic_address_16bit(BX_CPU(which_cpu)->guard_found.eip, - BX_CPU(which_cpu)->sregs[BX_SEG_REG_CS].selector.value)); + bx_dbg_symbolic_address(0, + BX_CPU(which_cpu)->guard_found.eip & 0xffff, + BX_CPU(which_cpu)->get_segment_base(BX_SEG_REG_CS))); } dbg_printf("%-25s ; ", bx_disasm_tbuf); for (unsigned j=0; jget_symbol_entry(s.name); - if(!sym) // Symbol not found + if(!sym) // symbol not found return 0; return sym->start; @@ -279,15 +273,6 @@ const char* bx_dbg_disasm_symbolic_address(Bit32u eip, Bit32u base) return buf; } -const char* bx_dbg_symbolic_address_16bit(Bit32u eip, Bit32u cs) -{ - // in 16-bit code, the segment selector and offset are combined into a - // 20-bit linear address = (segment selector<<4) + offset. - eip &= 0xffff; - cs &= 0xffff; - return bx_dbg_symbolic_address (0, eip+(cs<<4), 0); -} - int bx_dbg_symbol_command(const char* filename, bx_bool global, Bit32u offset) { symbol_entry_t file(0, filename); @@ -364,7 +349,7 @@ static bool bx_dbg_strprefix(const char *s1, const char *s2) return strncmp(s1, s2, len)==0; } -void bx_dbg_info_symbols_command(const char *Symbol) +void bx_dbg_info_symbols_command(const char *symbol) { context_t* cntx = context_t::get_context(0); @@ -373,16 +358,16 @@ void bx_dbg_info_symbols_command(const char *Symbol) return; } - if(Symbol) { + if(symbol) { const context_t::rsym_set_t* rsyms; rsyms=cntx->get_all_rsymbols(); if (rsyms->empty ()) { - dbg_printf ("Symbols not loaded\n"); + dbg_printf ("symbols not loaded\n"); return; } - symbol_entry_t probe(0, Symbol); + symbol_entry_t probe(0, symbol); // remove leading and trailing quotas probe.trim_quotes(); context_t::rsym_set_t::const_iterator iter; @@ -400,8 +385,8 @@ void bx_dbg_info_symbols_command(const char *Symbol) const context_t::sym_set_t* syms; syms=cntx->get_all_symbols(); - if (syms->empty ()) { - dbg_printf ("Symbols not loaded\n"); + if (syms->empty()) { + dbg_printf ("symbols not loaded\n"); return; } @@ -426,7 +411,7 @@ int bx_dbg_lbreakpoint_symbol_command(const char *symbol) const symbol_entry_t* sym=cntx->get_symbol_entry(probe.name); if(sym) return bx_dbg_lbreakpoint_command(bkRegular, sym->start); - dbg_printf ("Symbol not found\n"); + dbg_printf ("symbol not found\n"); return -1; }