ESP8266 Developer Zone The Official ESP8266 Forum 2018-07-11T04:47:59+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=9162 2018-07-11T04:47:59+08:00 2018-07-11T04:47:59+08:00 https://bbs.espressif.com:443/viewtopic.php?t=9162&p=22040#p22040 <![CDATA[Re: GDBStub throws exception]]>
Bernard wrote:
The only thing I can imagine is that this function is at a location you are not authorized to write and this will generate the exception...

It's because IRAM may only be read and written in aligned 32-bit words, but the failing instruction attempts to write 16 bits.

Statistics: Posted by jcmvbkbc — Wed Jul 11, 2018 4:47 am


]]>
2018-06-08T23:39:44+08:00 2018-06-08T23:39:44+08:00 https://bbs.espressif.com:443/viewtopic.php?t=9162&p=20674#p20674 <![CDATA[Re: GDBStub throws exception]]> user_fatal_exception_handler() function?
The only thing I can imagine is that this function is at a location you are not authorized to write and this will generate the exception...

Statistics: Posted by Bernard — Fri Jun 08, 2018 11:39 pm


]]>
2018-02-03T23:48:09+08:00 2018-02-03T23:48:09+08:00 https://bbs.espressif.com:443/viewtopic.php?t=9162&p=19312#p19312 <![CDATA[GDBStub throws exception]]>
So I have an application I need to debug with GDBStub. I compiled my application along side gdb stub and then a fatal exception 3 begins. I decompiled the the elf to find the location of the exception and it turs out to be within gdbstub_init itself

Code:

Fatal exception (3):
epc1=0x4026ffc4
epc2=0x00000000
epc3=0x402213bb
epcvaddr=0x401010b8
depc=0x00000000
retn_add=0x4027084c


Address 4026ffc4 is this

Code:

static void ATTR_GDBINIT install_exceptions() {
//Replace the user_fatal_exception_handler by a jump to our own code
int *ufe=(int*)user_fatal_exception_handler;
//This mess encodes as a relative jump instruction to user_fatal_exception_handler
*ufe=((((int)gdbstub_user_exception_entry-(int)user_fatal_exception_handler)-4)<<6)|6;
4026ffb0: ffff41 l32r a4, 4026ffac <getaregval+0x24>
4026ffb3: fffd21 l32r a2, 4026ffa8 <getaregval+0x20>
4026ffb6: fcc222 addi a2, a2, -4
4026ffb9: c02240 sub a2, a2, a4
4026ffbc: 1122a0 slli a2, a2, 6
4026ffbf: 630c movi.n a3, 6
4026ffc1: 202230 or a2, a2, a3
4026ffc4: 005422 s16i a2, a4, 0
4026ffc7: f52020 extui a2, a2, 16, 16
4026ffca: 015422 s16i a2, a4, 2
4026ffcd: f00d ret.n


I realized gdb was trying to modify the IRAM address of user_fatal_exception_handler in the SDK.
But I dont understand why it throws at this point

Statistics: Posted by sake402 — Sat Feb 03, 2018 11:48 pm


]]>