Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>,
	 Pedro Alves <palves@redhat.com>,
	 gdb-patches@sourceware.org
Subject: Re: [PATCH 2/4] Implements aarch64 process record and reverse debugging support
Date: Wed, 27 May 2015 10:22:00 -0000	[thread overview]
Message-ID: <868ucaqq0o.fsf@gmail.com> (raw)
In-Reply-To: <86d21mqvl0.fsf@gmail.com> (Yao Qi's message of "Wed, 27 May 2015	09:21:47 +0100")

Yao Qi <qiyaoltc@gmail.com> writes:

>> 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.

Here is the patch below, it fixes the build failure on my machine.  Does
it work for you too?

-- 
Yao (齐尧)

From: Yao Qi <yao.qi@linaro.org>
Date: Wed, 27 May 2015 11:08:40 +0100
Subject: [PATCH] [aarch64] Handle unknown instruction encoding

We see the following build error:

 gdb/aarch64-tdep.c: In function ‘aarch64_process_record’:
 gdb/aarch64-tdep.c:2823:17: 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];

since record_buf[0] isn't initialized in some paths in which
instruction encodings doesn't exist in current ARMv8 reference manual.
This patch is to let the function return AARCH64_RECORD_UNKNOWN for
these paths.

gdb:

2015-05-27  Yao Qi  <yao.qi@linaro.org>

	* aarch64-tdep.c (aarch64_record_data_proc_simd_fp): Return
	AARCH64_RECORD_UNKNOWN for unknown instruction encoding.

diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 8597497..d07b26c 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -3592,7 +3592,7 @@ aarch64_record_data_proc_simd_fp (insn_decode_record *aarch64_insn_r)
 	      record_buf[0] = AARCH64_CPSR_REGNUM;
 	    }
 	  /* Floating point - integer conversions instructions.  */
-	  if (insn_bits12_15 == 0x00)
+	  else if (insn_bits12_15 == 0x00)
 	    {
 	      /* Convert float to integer instruction.  */
 	      if (!(opcode >> 1) || ((opcode >> 1) == 0x02 && !rmode))
@@ -3621,8 +3621,14 @@ aarch64_record_data_proc_simd_fp (insn_decode_record *aarch64_insn_r)
 		  else
 		    record_buf[0] = reg_rd + AARCH64_V0_REGNUM;
 		}
+	      else
+		return AARCH64_RECORD_UNKNOWN;
             }
+	  else
+	    return AARCH64_RECORD_UNKNOWN;
         }
+      else
+	return AARCH64_RECORD_UNKNOWN;
     }
   else if ((insn_bits28_31 & 0x09) == 0x00 && insn_bits24_27 == 0x0e)
     {


  parent reply	other threads:[~2015-05-27 10:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-19 13:22 [PATCH 0/4 V6] Process record and reverse debugging support on aarch64-linux Yao Qi
2015-05-19 13:22 ` [PATCH 1/4] NEWS entry about aarch64-linux record/replay support Yao Qi
2015-05-19 13:22 ` [PATCH 2/4] Implements aarch64 process record and reverse debugging support Yao Qi
2015-05-21 20:23   ` Pedro Alves
2015-05-26 11:41     ` Yao Qi
2015-05-26 20:00       ` Edjunior Barbosa Machado
2015-05-27  8:21         ` Yao Qi
2015-05-27  9:23           ` Yao Qi
2015-05-27 10:22           ` Yao Qi [this message]
2015-05-27 14:12             ` Edjunior Barbosa Machado
2015-05-27 15:05               ` Yao Qi
     [not found]                 ` <5565E8BE.4060506@linux.vnet.ibm.com>
2015-05-27 16:18                   ` Yao Qi
2015-05-19 13:23 ` [PATCH 3/4] Enables gdb.reverse testsuite for aarch64*-linux targets Yao Qi
2015-05-19 13:23 ` [PATCH 4/4] New gdb.reverse test case for aarch64 instructions Yao Qi
2015-05-21 20:22   ` Pedro Alves
2015-05-26 11:26     ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=868ucaqq0o.fsf@gmail.com \
    --to=qiyaoltc@gmail.com \
    --cc=emachado@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox