This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] arm reversible : <phase_2_complete>


On 3 December 2011 20:01, oza Pawandeep <oza.pawandeep@gmail.com> wrote:
> Hi Tom and Petr,
>
> This patch includes both of your comments; I have worked both on
> formatting and comments, and try to make the patch look ok.
> the patch is derived from gdb-7.3.50.20111203 current snapshot.
>

In function decode_insn:
> +
> + Âstruct
> + Â Â{
> + Â Â Âgdb_byte buf[insn_size];
> + Â Â} u_buf;
> +
> + Âuint32_t ret=0, insn_id = 0;
> +
> + Âmemset (&u_buf, 0, sizeof(u_buf));
> + Âif (target_read_memory (arm_record->this_addr, &u_buf.buf[0], insn_size))

I wonder why is there a `struct u_buf'. Having local variable
`buf[insn_size];' would be sufficient and obvious. I am sorry to not
discover that earlier. The same thing applies to arm_process_record().

In arm_process_record ()
> +
> + Âstruct
> + Â Â Â{
> + Â Â Â Âgdb_byte buf[2];
> + Â Â Â} u_buf;
> +
> + Â...
> +
> + Âarm_record.arm_insn = (uint32_t) extract_unsigned_integer (&u_buf.buf[0],
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â THUMB_INSN_SIZE_BYTES ,
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â gdbarch_byte_order (arm_record.gdbarch));

Well, when I said that you probably forgot to copy
extract_unsigned_integer() I should have also said that you should
have also copied the line
target_read_memory (arm_record->this_addr, &u_buf.buf[0], insn_size)
Right now extract_unsigned_integer() reads an uninitialized buffer. :-T

-- 
Petr Hluzin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]