From 7809380fe13dfa6b18c916bf2195d4e826129c05 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Fri, 22 Sep 2023 20:28:52 +0200 Subject: [PATCH] gdbtrace.init: Fix describeETM definition. Fixes #120 --- Support/gdbtrace.init | 181 ++++++++++++++++++++++-------------------- 1 file changed, 93 insertions(+), 88 deletions(-) diff --git a/Support/gdbtrace.init b/Support/gdbtrace.init index aac8c5a8..e7cff86d 100644 --- a/Support/gdbtrace.init +++ b/Support/gdbtrace.init @@ -339,106 +339,111 @@ define describeETM #set language c if (((*$TRCDEVARCH)&0xfff0ffff) ==0x47704a13) - echo ETMv4. - output (((*$TRCDEVARCH)>>16)&0x0f) - echo \n - set $i=0 - while $i<8 + echo ETMv4. + output (((*$TRCDEVARCH)>>16)&0x0f) + echo \n + set $i=0 + while $i<8 output $i echo : output/x *($TRCIDR0+4*$i) set $i = $i+1 echo \n - end - if (((*$TRCIDR0)>>1)&3==3) - echo Tracing of Load and Store instructions as P0 elements is supported\n - else - echo Tracing of Load and Store instructions as P0 elements is not supported\n - end - - if (((*$TRCIDR0)>>3)&3==3) - echo Data tracing is supported\n - else - echo Data tracing is not supported\n - end - - if (((*$TRCIDR0)>>5)&1==1) - echo Branch broadcast is supported\n - else - echo Branch broadcast is not supported\n - end - - if (((*$TRCIDR0)>>6)&1==1) - echo Conditional Tracing is supported\n - else - echo Conditional Tracing is not supported\n - end - - if (((*$TRCIDR0)>>7)&1==1) - echo Instruction Cycle Counting is supported\n - else - echo Instruction Cycle Counting is not supported\n - end - - if (((*$TRCIDR0)>>9)&1==1) - echo Return Stacking is supported\n - else - echo Return Stacking is not supported\n - end - - if (((*($TRCIDR0+12))>>26)&3==3) - echo Stall is supported\n - else - echo Stalling is not supported\n - end - - - else - set $etmval = *($ETMBASE+0x1e4) - output ((($etmval>>8)&0x0f)+1) - echo . - output (($etmval>>4)&0x0f) - echo Rev - output (($etmval)&0x0f) - echo \n - if (((($etmval)>>24)&0xff)==0x41) - echo Implementer is ARM\n - end - if (((($etmval)>>24)&0xff)==0x44) - - echo Implementer is DEC\n - end - if (((($etmval)>>24)&0xff)==0x4D) - echo Implementer is Motorola/Freescale/NXP\n - end - if (((($etmval)>>24)&0xff)==0x51) - echo Implementer is Qualcomm\n - end - if (((($etmval)>>24)&0xff)==0x56) - echo Implementer is Marvell\n - end - if (((($etmval)>>24)&0xff)==0x69) - echo Implementer is Intel\n - end - - if ($etmval&(1<<18)) - echo 32-bit Thumb instruction is traced as single instruction\n + end + + if (((*$TRCIDR0)>>1)&3==3) + echo Tracing of Load and Store instructions as P0 elements is supported\n else - echo 32-bit Thumb instruction is traced as two instructions\n - end - if ($etmval&(1<<19)) - echo Implements ARM architecture security extensions\n + echo Tracing of Load and Store instructions as P0 elements is not supported\n + end + + if (((*$TRCIDR0)>>3)&3==3) + echo Data tracing is supported\n else - echo No ARM architecture security extensions\n - end - if ($etmval&(1<<20)) - echo Uses alternative Branch Packet Encoding\n + echo Data tracing is not supported\n + end + + if (((*$TRCIDR0)>>5)&1==1) + echo Branch broadcast is supported\n + else + echo Branch broadcast is not supported\n + end + + if (((*$TRCIDR0)>>6)&1==1) + echo Conditional Tracing is supported\n + else + echo Conditional Tracing is not supported\n + end + + if (((*$TRCIDR0)>>7)&1==1) + echo Instruction Cycle Counting is supported\n + else + echo Instruction Cycle Counting is not supported\n + end + + if (((*$TRCIDR0)>>9)&1==1) + echo Return Stacking is supported\n + else + echo Return Stacking is not supported\n + end + + if (((*($TRCIDR0+12))>>26)&3==3) + echo Stall is supported\n else - echo Uses original Branch Packet Encoding\n + echo Stalling is not supported\n + end + + else + set $etmval = *($ETMBASE+0x1e4) + output ((($etmval>>8)&0x0f)+1) + echo . + output (($etmval>>4)&0x0f) + echo Rev + output (($etmval)&0x0f) + echo \n + + if (((($etmval)>>24)&0xff)==0x41) + echo Implementer is ARM\n + end + if (((($etmval)>>24)&0xff)==0x44) + echo Implementer is DEC\n + end + if (((($etmval)>>24)&0xff)==0x4D) + echo Implementer is Motorola/Freescale/NXP\n + end + if (((($etmval)>>24)&0xff)==0x51) + echo Implementer is Qualcomm\n + end + if (((($etmval)>>24)&0xff)==0x56) + echo Implementer is Marvell\n + end + if (((($etmval)>>24)&0xff)==0x69) + echo Implementer is Intel\n + end + + if ($etmval&(1<<18)) + echo 32-bit Thumb instruction is traced as single instruction\n + else + echo 32-bit Thumb instruction is traced as two instructions\n + end + + if ($etmval&(1<<19)) + echo Implements ARM architecture security extensions\n + else + echo No ARM architecture security extensions\n + end + + if ($etmval&(1<<20)) + echo Uses alternative Branch Packet Encoding\n + else + echo Uses original Branch Packet Encoding\n + end end #set language auto + end + document describeETM Provide information about the ETM implementation on this target. end