diff -r b4b157088bc8 gdb-768/src/gdb/disasm.c --- a/gdb-768/src/gdb/disasm.c Wed Aug 12 10:58:48 2009 +0100 +++ b/gdb-768/src/gdb/disasm.c Wed Aug 26 15:09:04 2009 +0100 @@ -98,8 +98,12 @@ int unmapped; int offset; int line; + struct cleanup *ui_out_chain; + struct cleanup *table_chain; + struct cleanup *tuple_chain; + for (pc = low; pc < high;) { char *filename = NULL; @@ -125,22 +129,49 @@ ui_out_field_string (uiout, "func-name", name); ui_out_text (uiout, "+"); ui_out_field_int (uiout, "offset", offset); - ui_out_text (uiout, ">:\t"); + ui_out_text (uiout, ">: "); } else - ui_out_text (uiout, ":\t"); - + ui_out_text (uiout, ": "); + if (filename != NULL) xfree (filename); if (name != NULL) xfree (name); + + ui_file_rewind (stb->stream); +// dump the disassembly raw bytes - ripped from gnu gdb latest cvs version +// fG! - 12/08/2009 +// save the initial disassembly address + CORE_ADDR old_pc = pc; + bfd_byte data; + int status; + int i; + +// this will return the disassembled instructions, but it will be buffered into the stream +// pc will hold the final address after the disassembly, so we can compute the length of the instruction +// the macro returns the number of bytes disassembled + pc += TARGET_PRINT_INSN (pc, di); + i = pc - old_pc; +// read the bytes from the initial address to the final address + for (; old_pc < pc; old_pc++) + { + status = (*di->read_memory_func) (old_pc, &data, 1, di); + if (status != 0) + (*di->memory_error_func) (status, old_pc, di); + // print the raw bytes + ui_out_message (uiout, 0, " %02x", (unsigned)data); + } + // to align the output... gdb tables don't work correctly :( + for (; i < 10 ; i++) ui_out_text(uiout, " "); + ui_out_text (uiout, " "); +// now we can finally print the buffered stream + ui_out_field_stream (uiout, "inst", stb); + ui_file_rewind (stb->stream); - ui_file_rewind (stb->stream); - pc += TARGET_PRINT_INSN (pc, di); - ui_out_field_stream (uiout, "inst", stb); - ui_file_rewind (stb->stream); - do_cleanups (ui_out_chain); - ui_out_text (uiout, "\n"); + do_cleanups (ui_out_chain); + ui_out_text (uiout, "\n"); + } return num_displayed; } @@ -630,6 +661,36 @@ int gdb_print_insn (CORE_ADDR memaddr, struct ui_file *stream) { - struct disassemble_info di = gdb_disassemble_info (current_gdbarch, stream); - return TARGET_PRINT_INSN (memaddr, &di); + struct ui_stream *stb = ui_out_stream_new (uiout); + struct cleanup *cleanups = make_cleanup_ui_out_stream_delete (stb); + struct disassemble_info di = gdb_disassemble_info (current_gdbarch, stb->stream); + // struct disassemble_info di = gdb_disassemble_info (current_gdbarch, stream); + struct disassemble_info * di2 = &di; + struct cleanup *ui_out_chain; + + ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); + int i; + CORE_ADDR old_pc = memaddr; + CORE_ADDR oldmemaddr = memaddr; + bfd_byte data; + int status; + ui_file_rewind (stb->stream); + memaddr = TARGET_PRINT_INSN (memaddr, &di); + oldmemaddr += memaddr; + for (; old_pc < oldmemaddr; old_pc ++) + { + status = (*di2->read_memory_func) (old_pc, &data, 1, di2); + if (status != 0) + (*di2->memory_error_func) (status, old_pc, di2); + ui_out_message (uiout, 0, " %02x", (unsigned)data); + } + i = memaddr; + for (; i<10; i++) ui_out_text(uiout, " "); + ui_out_text (uiout, " "); + ui_out_field_stream(uiout, "inst", stb); + ui_file_rewind (stb->stream); + do_cleanups (ui_out_chain); + + return memaddr; + // return TARGET_PRINT_INSN (memaddr, &di); } diff -r b4b157088bc8 gdb-768/src/gdb/printcmd.c --- a/gdb-768/src/gdb/printcmd.c Wed Aug 12 10:58:48 2009 +0100 +++ b/gdb-768/src/gdb/printcmd.c Wed Aug 26 15:09:04 2009 +0100 @@ -770,7 +770,9 @@ print_address (CORE_ADDR addr, struct ui_file *stream) { deprecated_print_address_numeric (addr, 1, stream); - print_address_symbolic (addr, stream, asm_demangle, " "); +// uncomment if you want to have the default symbolic name printing after the address in every line +// fG! 12/08/2009 +// print_address_symbolic (addr, stream, asm_demangle, " "); } /* Print address ADDR symbolically on STREAM. Parameter DEMANGLE @@ -864,7 +866,7 @@ i > 0 && count > 0; i--, count--) { - printf_filtered ("\t"); + printf_filtered (" "); /* Note that print_formatted sets next_address for the next object. */ last_examine_address = next_address; @@ -887,6 +889,9 @@ release_value (last_examine_value); print_formatted (last_examine_value, format, size, gdb_stdout); + // uncomment if you want to have the symbolic name printed in every line + // fG! 12/08/2009 + //print_address_symbolic (next_address, gdb_stdout, asm_demangle, " \t\t\t"); } printf_filtered ("\n"); gdb_flush (gdb_stdout);