You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/04/22 08:07:24 UTC
[GitHub] [incubator-nuttx] anjiahao1 opened a new pull request, #6129: tools:minidumpserver.py support xtensa
anjiahao1 opened a new pull request, #6129:
URL: https://github.com/apache/incubator-nuttx/pull/6129
Signed-off-by: anjiahao <an...@xiaomi.com>
## Summary
support crash log debug on xtensa
## problem
The register sequence numbers of different xtensa gdb versions are inconsistent. In minidumpsevers.py, xtensa is tested based on xtensa-esp32-gdb. I have tried to use the latest version of gdb source code to compile the xtensa architecture. The register sequence and endian is on xtensa-esp32-gdb different.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6129: tools:minidumpserver.py support xtensa
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6129:
URL: https://github.com/apache/incubator-nuttx/pull/6129#discussion_r859949765
##########
tools/minidumpserver.py:
##########
@@ -261,6 +283,11 @@ def parse(self):
memory = {"start": start, "end": start + len(data), "data": data}
self.memories.append(memory)
+ # hardcode to handle xtensa A0 register.
+ if self.arch == "xtensa":
+ self.registers[reg_table[self.arch]["A0"]] &= 0x3fffffff
Review Comment:
let's remove the hack. It isn't enough to just correct one frame pointer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] Ouss4 commented on pull request #6129: tools:minidumpserver.py support xtensa
Posted by GitBox <gi...@apache.org>.
Ouss4 commented on PR #6129:
URL: https://github.com/apache/incubator-nuttx/pull/6129#issuecomment-1106433773
> @Ouss4 Hi ,I encountered a problem. In the architecture of xtensa, the highest bit of the A0 register is always set to 1. During debugging with gdb, the address accessed is` 0x800XXXXX`, but the actual address is` 0x400XXXXX`. I see that you are in openocd After doing related work, will openocd `BIT AND` the highest bit of the A0 register? Looking forward to your reply.
Hi,
That's normal behavior. A0 (the return address) also encodes the call increment in its most significant two bits (31 and 30), the address is the rest of the bits. The call increment is used by the `ret` instruction to determine the value to rotate the window with.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] anjiahao1 commented on pull request #6129: tools:minidumpserver.py support xtensa
Posted by GitBox <gi...@apache.org>.
anjiahao1 commented on PR #6129:
URL: https://github.com/apache/incubator-nuttx/pull/6129#issuecomment-1106438080
> > @Ouss4 Hi ,I encountered a problem. In the architecture of xtensa, the highest bit of the A0 register is always set to 1. During debugging with gdb, the address accessed is` 0x800XXXXX`, but the actual address is` 0x400XXXXX`. I see that you are in openocd After doing related work, will openocd `BIT AND` the highest bit of the A0 register? Looking forward to your reply.
>
> Hi, That's normal behavior. A0 (the return address) also encodes the call increment in its most significant two bits (31 and 30), the address is the rest of the bits. The call increment is used by the `ret` instruction to determine the value to rotate the window with.
>
> > will openocd BIT AND the highest bit of the A0 register?
>
> yes, anytime we want the "true" return address from A0, we just ignore the highest two bits.
Thanks for your reply, the A0 in the analysis register is easy to handle, but the A0 in the dump_stack is indistinguishable from the general local variables.How to distinguish A0 and local variables in stack?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6129: tools:minidumpserver.py support xtensa
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6129:
URL: https://github.com/apache/incubator-nuttx/pull/6129#issuecomment-1111150040
Anyway, this patch isn't related to the discussion, let's merge it first.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] anjiahao1 commented on pull request #6129: tools:minidumpserver.py support xtensa
Posted by GitBox <gi...@apache.org>.
anjiahao1 commented on PR #6129:
URL: https://github.com/apache/incubator-nuttx/pull/6129#issuecomment-1106207098
@Ouss4 Hi ,I encountered a problem. In the architecture of xtensa, the highest bit of the A0 register is always set to 1. During debugging with gdb, the address accessed is` 0x800XXXXX`, but the actual address is` 0x400XXXXX`. I see that you are in openocd After doing related work, will openocd drop the highest bit of the A0 register? Looking forward to your reply.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] Ouss4 commented on pull request #6129: tools:minidumpserver.py support xtensa
Posted by GitBox <gi...@apache.org>.
Ouss4 commented on PR #6129:
URL: https://github.com/apache/incubator-nuttx/pull/6129#issuecomment-1106461354
>. but the A0 in the dump_stack is indistinguishable from the general local variables.How to distinguish A0 and local variables in stack?
Do you mean when the registers are spilled? In that case A0 along side A1, A2 and A3, will be in the base save area. This is located below the stack frame and can be accessed with negative offsets from SP, `l32i a0, sp, -16` for instance for A0. I am not sure if I understood the question correctly, though.
@xiaoxiang781216 the code should be similar to this: https://github.com/apache/incubator-nuttx/blob/master/tools/esp32/backtrace.gdbscript#L56-L67
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6129: tools:minidumpserver.py support xtensa
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6129:
URL: https://github.com/apache/incubator-nuttx/pull/6129#issuecomment-1106446096
> > @Ouss4 Hi ,I encountered a problem. In the architecture of xtensa, the highest bit of the A0 register is always set to 1. During debugging with gdb, the address accessed is` 0x800XXXXX`, but the actual address is` 0x400XXXXX`. I see that you are in openocd After doing related work, will openocd `BIT AND` the highest bit of the A0 register? Looking forward to your reply.
>
> Hi, That's normal behavior. A0 (the return address) also encodes the call increment in its most significant two bits (31 and 30), the address is the rest of the bits. The call increment is used by the `ret` instruction to determine the value to rotate the window with. A value of `10` (as you are seeing it) means that the function was called using a `call8` instruction. `01` for `call4` and `11` for `call12`.
>
> > will openocd BIT AND the highest bit of the A0 register?
>
> yes, anytime we want the "true" return address from A0, we just ignore the highest two bits.
@Ouss4 could you point out which source code(OpenOCD or gdb) mask out the high 2bits? We want to simulate the same behavior in minidumpserver.py by learning it's algo.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6129: tools:minidumpserver.py support xtensa
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6129:
URL: https://github.com/apache/incubator-nuttx/pull/6129#issuecomment-1111147358
> use hardcode to mask high bit 31-30 for A0 ,it work,but gdb just can see the frist call stack,and gdb output `Backtrace stopped: Cannot access memory at address 0x0` 
@Ouss4 and @anjiahao1 how about we patch gdb backtrace code to remove the high two bit from frame point? Instead do the trick inside OpenOCD or minidumpsever.py:
https://github.com/espressif/openocd-esp32/blob/9d736dcba9aedd75933e873a644112a01e3d7f6c/src/rtos/rtos_freertos_stackings.c#L891
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] anjiahao1 commented on pull request #6129: tools:minidumpserver.py support xtensa
Posted by GitBox <gi...@apache.org>.
anjiahao1 commented on PR #6129:
URL: https://github.com/apache/incubator-nuttx/pull/6129#issuecomment-1107811438
use hardcode to mask high bit 31-30 for A0 ,it work,but gdb just can see the frist call stack,and gdb output `Backtrace stopped: Cannot access memory at address 0x0`

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6129: tools:minidumpserver.py support xtensa
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6129:
URL: https://github.com/apache/incubator-nuttx/pull/6129#issuecomment-1106527176
> @xiaoxiang781216 the code should be similar to this: https://github.com/apache/incubator-nuttx/blob/master/tools/esp32/backtrace.gdbscript#L56-L67
minidumpserver.py is a little bit complex:
https://github.com/apache/incubator-nuttx/blob/master/tools/minidumpserver.py#L377-L417
because gdb just say it want to read a block memory from [start, start + len), we can't blindly mask the high 2bits here since the memory content mayn't always content the pointer. We need some method to identify whether the content is a pointer or not.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #6129: tools:minidumpserver.py support xtensa
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #6129:
URL: https://github.com/apache/incubator-nuttx/pull/6129
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org