Skip to content

Commit

Permalink
last changes
Browse files Browse the repository at this point in the history
  • Loading branch information
therealdreg authored and stlintel committed Apr 25, 2024
1 parent 0aec6cd commit 2c536b0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 25 deletions.
34 changes: 11 additions & 23 deletions bochs/bx_debug/dbg_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2001,11 +2001,9 @@ void bx_dbg_telescope(bx_address addr)

last_valid_addr = addr;
curr_addr = addr;
for (int i = 0; i < telescope_max_depth; i++)
{
for (int i = 0; i < telescope_max_depth + 1; i++) {
deref_data = bx_dbg_deref(curr_addr, 1, &deep_sc, NULL, true);
if (0 != deep_sc)
{
if (0 != deep_sc) {
print_data = true;
break;
}
Expand All @@ -2015,8 +2013,7 @@ void bx_dbg_telescope(bx_address addr)

last_valid_addr = curr_addr;

if (deref_data == curr_addr)
{
if (deref_data == curr_addr) {
dbg_printf("iloop");
break;
}
Expand All @@ -2025,20 +2022,16 @@ void bx_dbg_telescope(bx_address addr)
}

if (print_data && bx_dbg_read_linear(dbg_cpu, last_valid_addr, telescope_data_depth, data, true)) {
if (telescope_data_hex)
{
if (telescope_data_hex) {
dbg_printf(" h'");
for (int i = 0; i < telescope_data_depth; i++)
{
for (int i = 0; i < telescope_data_depth; i++) {
dbg_printf("%02x", data[i]);
}
dbg_printf("'");
}
else
{
else {
dbg_printf(" s'");
for (int i = 0; i < telescope_data_depth; i++)
{
for (int i = 0; i < telescope_data_depth; i++) {
if (data[i] < 0x20 || data[i] > 0x7E)
data[i] = '.';
}
Expand All @@ -2060,15 +2053,10 @@ void bx_dbg_telescopeset_command(unsigned int max_rows, unsigned int max_depth,
telescope_data_hex = data_hex;
}

void bx_dbg_telescope_command(bx_address addr, unsigned nrows)
void bx_dbg_telescope_command(bx_address addr)
{
unsigned len;

if (nrows == 0)
{
nrows = telescope_max_rows;
}

BX_CPU_C *cpu = BX_CPU(dbg_cpu);

#if BX_SUPPORT_X86_64
Expand All @@ -2086,12 +2074,12 @@ void bx_dbg_telescope_command(bx_address addr, unsigned nrows)
}
}

for (unsigned i = 0; i < nrows; i++) {
for (unsigned i = 0; i < telescope_max_rows; i++) {
#if BX_SUPPORT_X86_64
if (len == 8) {
dbg_printf("0x%08x%08x ", GET32H(addr), GET32L(addr));
bx_dbg_telescope(addr);
dbg_printf("\n");
bx_dbg_telescope(addr);
dbg_printf("\n");
}
else
#endif
Expand Down
2 changes: 1 addition & 1 deletion bochs/bx_debug/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void bx_dbg_print_stack_command(unsigned nwords);
void bx_dbg_deref_command(bx_address addr, unsigned deep);
bx_address bx_dbg_deref(bx_address addr, unsigned deep, unsigned* error_deep, bx_address* last_data_found, bool quiet);
void bx_dbg_telescope(bx_address addr);
void bx_dbg_telescope_command(bx_address addr, unsigned nwords);
void bx_dbg_telescope_command(bx_address addr);
void bx_dbg_telescopeset_command(unsigned int max_rows, unsigned int max_depth, unsigned int data_depth, bool data_hex);
void bx_dbg_bt_command(unsigned dist);
void bx_dbg_print_watchpoints(void);
Expand Down
2 changes: 1 addition & 1 deletion bochs/bx_debug/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ deref_command:
telescope_command:
BX_TOKEN_TELESCOPE expression '\n'
{
bx_dbg_telescope_command($2, 0);
bx_dbg_telescope_command($2);
free($1);
}
;
Expand Down

0 comments on commit 2c536b0

Please sign in to comment.