sim: rfa: disassembly in cgen-based trace
Dave Brolley
brolley@redhat.com
Mon Aug 28 11:41:00 GMT 2000
Approved offline by Frank Eigler -- committed.
Dave Brolley wrote:
> Hi,
>
> The attached patch fixes a problem with incorrectly displayed
> disassembly in the trace output of cgen-based simulators.
> Basically, the trace output was accessing fields which were not
> ever written into the insn word. The patch ensures that, when an
> insn fits into an integer, then the entire insn is written there,
> not just the bits represented by base-insn-bitsize. Insns which
> do not fit into an integer are handled by another mechanism.
>
> OK to commit?
>
> Dave
>
> ------------------------------------------------------------------------
> 2000-08-22 Dave Brolley <brolley@redhat.com>
>
> * cgen-trace.c (sim_cgen_disassemble_insn): Make sure entire insn is
> in insn_value if it will fit.
>
> ------------------------------------------------------------------------
> Index: sim/common/cgen-trace.c
> ===================================================================
> RCS file: /cvs/src/src/sim/common/cgen-trace.c,v
> retrieving revision 1.1.1.3
> diff -c -p -r1.1.1.3 cgen-trace.c
> *** cgen-trace.c 1999/12/07 03:56:37 1.1.1.3
> --- cgen-trace.c 2000/08/22 19:59:19
> *************** sim_cgen_disassemble_insn (SIM_CPU *cpu,
> *** 354,359 ****
> --- 354,360 ----
> const ARGBUF *abuf, IADDR pc, char *buf)
> {
> unsigned int length;
> + unsigned int base_length;
> unsigned long insn_value;
> struct disassemble_info disasm_info;
> SFILE sfile;
> *************** sim_cgen_disassemble_insn (SIM_CPU *cpu,
> *** 380,386 ****
> length = sim_core_read_buffer (sd, cpu, read_map, &insn_buf, pc,
> insn_length);
>
> ! switch (min (cd->base_insn_bitsize, insn_bit_length))
> {
> case 0 : return; /* fake insn, typically "compile" (aka "invalid") */
> case 8 : insn_value = insn_buf.bytes[0]; break;
> --- 381,393 ----
> length = sim_core_read_buffer (sd, cpu, read_map, &insn_buf, pc,
> insn_length);
>
> ! /* If the entire insn will fit into an integer, then do it. Otherwise, just
> ! use the bits of the base_insn. */
> ! if (insn_bit_length <= 32)
> ! base_length = insn_bit_length;
> ! else
> ! base_length = min (cd->base_insn_bitsize, insn_bit_length);
> ! switch (base_length)
> {
> case 0 : return; /* fake insn, typically "compile" (aka "invalid") */
> case 8 : insn_value = insn_buf.bytes[0]; break;
More information about the Gdb-patches
mailing list