diff mbox

[2/4] Implements aarch64 process record and reverse debugging support

Message ID 5564D0E9.3000402@linux.vnet.ibm.com
State New
Headers show

Commit Message

Edjunior Barbosa Machado May 26, 2015, 8 p.m. UTC
On 05/26/2015 08:41 AM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> writes:
> 
>> Off by one?
>>
> Oh, good catch.  It should be:
> 
> 	* linux-record.h (struct linux_record_tdep) <arg7>: New field.
> 
>> Looked fine to me otherwise (I just skimmed it; didn't really look at
>> anything aarch64 specific in detail).
> 
> Thanks for looking at them...  I'll push them in.
> 

Hi,

noticed this commit (99afc8) introduced this issue when checking for uninitialized vars:

gcc -g -O2 -mminimal-toc  -I. -I../../gdb -I../../gdb/common -I../../gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I../../gdb/../include/opcode -I../../gdb/../opcodes/.. -I../../gdb/../readline/.. -I../../gdb/../zlib -I../bfd -I../../gdb/../bfd -I../../gdb/../include -I../libdecnumber -I../../gdb/../libdecnumber  -I../../gdb/gnulib/import -Ibuild-gnulib/import   -DTUI=1  -I/usr/include/python2.7 -I/usr/include/python2.7 -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wpointer-sign -Wmissing-prototypes -Wdeclaration-after-statement -Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition -Wformat-nonliteral -Werror -c -o aarch64-tdep.o -MT aarch64-tdep.o -MMD -MP -MF .deps/aarch64-tdep.Tpo ../../gdb/aarch64-tdep.c
../../gdb/aarch64-tdep.c: In function ‘aarch64_process_record’:
../../gdb/aarch64-tdep.c:2823:23: error: ‘record_buf[0]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
                 memcpy(&REGS[0], &RECORD_BUF[0], sizeof(uint32_t)*LENGTH); \
                       ^
../../gdb/aarch64-tdep.c:3529:12: note: ‘record_buf[0]’ was declared here
   uint32_t record_buf[2];
            ^

The simple patch below intends to fix this. Ok?

Thanks,
--
Edjunior

2015-05-26  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

	* aarch64-tdep.c: (aarch64_record_data_proc_simd_fp) Avoid uninitialized
	variable warning.

Comments

Yao Qi May 27, 2015, 8:21 a.m. UTC | #1
Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com> writes:

> noticed this commit (99afc8) introduced this issue when checking for uninitialized vars:
>

Sorry for breaking the build.

> gcc -g -O2 -mminimal-toc  -I. -I../../gdb -I../../gdb/common -I../../gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I../../gdb/../include/opcode -I../../gdb/../opcodes/.. -I../../gdb/../readline/.. -I../../gdb/../zlib -I../bfd -I../../gdb/../bfd -I../../gdb/../include -I../libdecnumber -I../../gdb/../libdecnumber  -I../../gdb/gnulib/import -Ibuild-gnulib/import   -DTUI=1  -I/usr/include/python2.7 -I/usr/include/python2.7 -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wpointer-sign -Wmissing-prototypes -Wdeclaration-after-statement -Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition -Wformat-nonliteral -Werror -c -o aarch64-tdep.o -MT aarch64-tdep.o -MMD -MP -MF .deps/aarch64-tdep.Tpo ../../gdb/aarch64-tdep.c
> ../../gdb/aarch64-tdep.c: In function ‘aarch64_process_record’:
> ../../gdb/aarch64-tdep.c:2823:23: error: ‘record_buf[0]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>                  memcpy(&REGS[0], &RECORD_BUF[0], sizeof(uint32_t)*LENGTH); \
>                        ^
> ../../gdb/aarch64-tdep.c:3529:12: note: ‘record_buf[0]’ was declared here
>    uint32_t record_buf[2];
>             ^
>
> The simple patch below intends to fix this. Ok?

This build error reveals some logic error inside function
aarch64_record_data_proc_simd_fp on decoding instructions.  I'll take a look.

What is your gcc version?  I use gcc-4.9 and gcc-5, but unable to
reproduce this compilation error.
Yao Qi May 27, 2015, 9:23 a.m. UTC | #2
On 27/05/15 09:21, Yao Qi wrote:
> What is your gcc version?  I use gcc-4.9 and gcc-5, but unable to
> reproduce this compilation error.

I can reproduce it now...
diff mbox

Patch

diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 8597497..73a7f99 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -3526,7 +3526,7 @@  aarch64_record_data_proc_simd_fp (insn_decode_record *aarch64_insn_r)
   uint8_t insn_bit21, opcode, rmode, reg_rd;
   uint8_t insn_bits24_27, insn_bits28_31, insn_bits10_11, insn_bits12_15;
   uint8_t insn_bits11_14;
-  uint32_t record_buf[2];
+  uint32_t record_buf[2] = { 0, 0 };
 
   insn_bits24_27 = bits (aarch64_insn_r->aarch64_insn, 24, 27);
   insn_bits28_31 = bits (aarch64_insn_r->aarch64_insn, 28, 31);