This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v7] Enable tracing of pseudo-registers on ARM
- From: Antoine Tremblay <antoine dot tremblay at ericsson dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: Antoine Tremblay <antoine dot tremblay at ericsson dot com>, <gdb-patches at sourceware dot org>
- Date: Fri, 26 Feb 2016 09:57:24 -0500
- Subject: Re: [PATCH v7] Enable tracing of pseudo-registers on ARM
- Authentication-results: sourceware.org; auth=none
- References: <wwokk2lr1vaa dot fsf at ericsson dot com> <1456491775-29750-1-git-send-email-antoine dot tremblay at ericsson dot com> <86lh67blt9 dot fsf at gmail dot com>
Yao Qi writes:
> Antoine Tremblay <antoine.tremblay@ericsson.com> writes:
>
>> gdb/testsuite/ChangeLog:
>>
>> * gdb.trace/tracefile-pseudo-reg.c: Include arm_neon.h if on arm.
>
> arm_neon.h is not included now, but stdint.h is included.
Yes this is due to the usage of uint32_t.
>
>> (main): Add a register variable and a tracepoint label.
>> * gdb.trace/tracefile-pseudo-reg.exp): Add arm pseudo register
>> tracing test with s5 pseudo register.
>
>> diff --git a/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.c b/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.c
>> index 3cc3ec0..33761c1 100644
>> --- a/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.c
>> +++ b/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.c
>> @@ -16,11 +16,15 @@
>> along with this program. If not, see <http://www.gnu.org/licenses/>. */
>>
>> /*
>> - * Test program for reading target description from tfile: collects AVX
>> - * registers on x86_64.
>> + * Test program for reading target description from tfile: collects pseudo
>> + * register on the target.
>> */
>
> The comment format doesn't comply to GNU coding standard. It should be
>
> /* Test program for reading target description from tfile: collects pseudo
> registers on the target. */
>
Fixed.
>>
>> +#if (defined __x86_64__)
>> #include <immintrin.h>
>> +#elif (defined __arm__)
>> +#include <stdint.h>
>> +#endif
>>
>> void
>> dummy (void)
>> @@ -35,6 +39,7 @@ end (void)
>> int
>> main (void)
>> {
>> +#if (defined __x86_64__)
>> /* Strictly speaking, it should be ymm15 (xmm15 is 128-bit), but gcc older
>> than 4.9 doesn't recognize "ymm15" as a valid register name. */
>> register __v8si a asm("xmm15") = {
>> @@ -48,6 +53,11 @@ main (void)
>> 0x12340008,
>> };
>> asm volatile ("traceme: call dummy" : : "x" (a));
>> +#elif (defined __arm__)
>> + register uint32_t a asm("s5") = 0x3f800000; /* 1. */
>> + asm volatile ("traceme: bl dummy" : : "x" (a));
>> +#endif
>> +
>> end ();
>> return 0;
>> }
>> diff --git a/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.exp b/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.exp
>> index 4c52c64..33677a1 100644
>> --- a/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.exp
>> +++ b/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.exp
>> @@ -12,8 +12,8 @@
>> # You should have received a copy of the GNU General Public License
>> # along with this program. If not, see <http://www.gnu.org/licenses/>.
>>
>> -if { ! [is_amd64_regs_target] } {
>> - verbose "Skipping tfile AVX test (target is not x86_64)."
>> +if { ! [is_amd64_regs_target] && ! [istarget "arm*-*-*"] } {
>> + verbose "Skipping tracefile pseudo register tests, target is not supported."
>> return
>> }
>>
>> @@ -21,8 +21,14 @@ load_lib "trace-support.exp"
>>
>> standard_testfile
>>
>> +set add_flags ""
>> +
>> +if { [is_amd64_regs_target] } {
>> + set add_flags "-mavx"
>> +}
>> +
>> if {[prepare_for_testing $testfile.exp $testfile $srcfile \
>> - [list debug additional_flags=-mavx]]} {
>> + [list debug additional_flags=$add_flags]]} {
>> return -1
>> }
>>
>> @@ -36,20 +42,31 @@ if ![gdb_target_supports_trace] {
>> return -1
>> }
>>
>> -gdb_test_multiple "print \$ymm15" "check for AVX support" {
>> +if { [is_amd64_regs_target] } {
>> + set reg "\$ymm15"
>> + set reg_message "check for AVX support"
>> +} elseif { [istarget "arm*-*-*"] } {
>> + set reg "\$s5"
>> + set reg_message "check for register $reg"
>> +}
>
> We can set reg_message out of the condition block,
>
> if { [is_amd64_regs_target] } {
> set reg "\$ymm15"
> } elseif { [istarget "arm*-*-*"] } {
> set reg "\$s5"
> }
>
> set reg_message "check for register $reg"
OK.
Patch v8 follows.