adamgreen / CrashCatcher

Catch Hard Faults on Cortex-M devices and save out a crash dump to be used by CrashDebug.
Apache License 2.0
220 stars 49 forks source link

Corrupt Backtrace #11

Closed git-dimiz closed 4 years ago

git-dimiz commented 4 years ago

Hi,

I'm trying to integrate your great library into my project. Unfortunately I encounter some problems. My example application looks like this:

void func_3(void)
{
    volatile int i = 0;
    __builtin_trap();
}

void func_2(void)
{
    func_3();
}

void func_1(void)
{
    func_2();
}

int main(int argc, char const *argv[])
{
    func_1();
    return 0;
}

The Crash dump:

63430300
01000000
00000000000000008802002000000000
000000000000000000000000D0FF0320
00000000000000000000032000000000
00000000
D0FF0320
3D0700003207000000000061
B0FF03200000000003000060
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000
28ED00E03CED00E0
00000100000000400000000034ED00E0
38ED00E0

and the gdb output:

Reading symbols from ./_build/nrf52840_xxaa.out...
Remote debugging using | ./CrashDebug --elf ./_build/nrf52840_xxaa.out --dump crash.txt
0x00000732 in func_3 () at main.c:4
4           volatile int i = 0;
#0  0x00000732 in func_3 () at main.c:4
        i = <error reading variable i (Cannot access memory at address 0x2003ffd4)>
Backtrace stopped: Cannot access memory at address 0x2003ffdc
A debugging session is active.

Is there a way to understand the problem in more detail? Why is the stack not fully unwinded until main?

Compiler: Gcc 7.3 MCU: Nordic NRF52840 Compiled with "O0".

adamgreen commented 4 years ago

It looks like you haven't implemented CrashCatcher_GetMemoryRegions() properly and CrashCatcher isn't dumping the contents of RAM correctly. A sample implementation can be found here. You would need to customize it for your particular microcontroller. I think it should look something like this for the nRF52840:

extern "C" const CrashCatcherMemoryRegion* CrashCatcher_GetMemoryRegions(void)
{
    static const CrashCatcherMemoryRegion regions[] = {
                                                        {0x20000000, 0x20040000, CRASH_CATCHER_BYTE}
                                                      };
    return regions;
}

What you do see it dump of your call stack is based on the contents of the PC and LR registers. To dump anymore of your call stack will require the contents of RAM, which includes the stack.

I hope that helps.

git-dimiz commented 4 years ago

Yes, the CrashCatcher_GetMemoryRegions function just returned NULL. Because I thought this is sufficient to display the stack trace.

As you recommended I've now implemented the CrashCatcher_GetMemoryRegions function:

const CrashCatcherMemoryRegion* CrashCatcher_GetMemoryRegions(void)
{
    static const CrashCatcherMemoryRegion regions[] = 
    {
        {0x2003E000, 0x20040000, CRASH_CATCHER_BYTE}
    };
    return regions;
}

Now my crash dump looks like this:

63430300
01000000
00000000000000008802002000000000
000000000000000000000000D0FF0320
00000000000000000000032000000000
00000000
D0FF0320
3D0700003207000000000061
B0FF03200000000003000060
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000
00E0032000000420
385A6CF5DB5D713462014459F9B349B0
EF072FC1528967F9B67795601C2B83C7
EB5B63938B944F1B22CBFC81CBB59D57
8717B2BEC88A74F7264520BA39AE386D
08F6C120FC225B9B01510237D9C5AC56
3C97A1AADCE21A788F849988F4212C64
14B4BAE0AF10B9CACA4B14F7CA76C147
215D4305D70F1A22233B53A343F8C477
0C884032067BD3555F9D3E81F9D441B8
29DC491C252B9C7B3B1E2685B570B5B8
5533A045158E727ABAD7663A4B413F0B
96228E5CE80B6B0D4F0FC616A71F1F22
6DAB9204864AF513891B2409B911A7CB
B105AC4CD9995AFD3C4A85F7E2556B06
D25F2A02EAC70B5A2021D6385D1DD6E9
F9CCC9613B7C146F14C59D9C667CBA67
048408334B95CF2374BA0939B51E8E59
3E063EB3ECF271B0F35E0BC5C08F3BD5
A027E8FEADB68176E21B90BFA3B2AB77
6DC62592E44A33E47B841626285D4A5F
E90C3E6DAEFB58DC7C0AF816105F6710
3F02076ACE0D9D61A2440C4EB8B515D0
141C03B5CE017C5E88F5477DFF41896D
FCDB7200CF7FAD75E105DDB7C8615E33
AA4070603F27550FB8B84AE1366E7A7F
F0DDD0DC9D6B4E37EBD72BB05F29AD3F
724945F17830F0E27898BC53D58B3D12
EC8C3999E8737F33B57613365F1D96F8
382C7447393483162B46494D3C0FD957
DE7D85E143353F98C126779EF3B67163
CDE704810D16783DE3B9E4D0DB43489A
2C3C902AE26835FFE80818B6B38E645D
D7CFF2336EBE609F0FEC201E52E0E909
330C7C74196F3FA8AB229330C28F55AC
3ADB72CFFB492A24CD8CC15014FCE251
0A291726A272DEDA98B1037241B9B5D0
02BA1D84F5CB3F1A49D5F4738DAF0F52
C82E1C8746BEB0832619B9B050F7BD85
92D32AAA000A9ADB875BA4B6B36CCD04
31B4F61ECFC96DF6B12EF3619491A9E7
1130D0EE50E2B6820C38C41A75A637FA
5C217B94EFA1BEBD15270B0C0AC4D9D5
4063C10D7043233C92088651CFEA9DBE
B32C4B90E77088C0C0D6D2E0C2FB7AD0
E92E0125E070B21720BC60C220E22632
270397D3DB3B22A9939A3C62F67EFBA7
55C5C977794B72468C5256C12196F7ED
04841159FDC45277F9108BC97F40A6F5
D8C6C40FC55A6B36E8577DA681B4A3B6
B644A156B3C80ED8EA1447A05B6569BF
57D47F16D94CCE7C5A6D78F30129A07C
E838B7F13880F77B6225C3845F2703E3
15E1895A5CDEF74B1DD3452D589BAC20
D0E870BD18433FDDFA69C0CAFAA3C773
AE71CB494C3EDC754CED3CA21E372AF7
FEE39E8597F9DCEED581EB401133BB6C
618719D160B2C7BB5349FCF1F49E2645
D6F47D290A09A4473833A30B96DEADD1
C6AD5C81A37E1F4E91A90C2B00E0E1FD
6872638F0345061D32DAE9A96D88FA2E
926C357CBAC36B666D5F5932555689A9
AD3135CDAF64F473ACD0480E83F1C36E
DE9091198A3F3D5B10226D7827B99759
45C571C9564081944388E455B7F6D6D4
913B4DDCC0A55C7E9092AB8E381332D4
1F43662CF7AEF437C9200F19C64A4096
3700CB63B3F11E59D48F166E84DE2764
4A36875AD4DFAAF3210685A1415C4A50
4DE7793FDB5C25A7C65D0B62355E2F28
402C6079ECE6571B875C79AF35C5CDB4
228E3FB290FD27158E9C8FC1B08D5F19
52BE2A26B40623A24D072BC1970B8D5C
9E40B0D0C95A189238554CFD2A78AFD1
B6E70102F6D846B9A42FF7055B3C65CD
2ACB1C918FB76DCB05F1D1F17523965D
AA475C00D959DB9E64256DE487FAA901
E96E02089A22EEC5050873A181F49C11
081DCB618743DB88A3A53949C5FDA9EF
8ABA10087A60D24BF0CB919AA87DC861
1D3FBAA056AC90BD037A207DDF80C3F1
81B00D7D38FDA9DB517E2D5302C66313
E448EF0D20CA76B85283C0C15B11B8B5
EB2B6A6097623CE1DC0EA17262882192
76EEAD0A8F9B39FD7A264FA049D614D6
962359E9059276CDA17AD4FE43281EC9
B523BA91FB95F57EB29F8D50628D3900
92896C80DC353A3AABBF9D2E83531694
0277354A71BF6A7B50E03B1529EA37E8
BC259528E97BA3C8CBADF8C9A4A5738B
7D14734A553CD1199D1F0A70370A2DB0
C950EA8AD7A2A6F0BA48EB54EBF6B777
CC7185B5735B972F5015E57D8A2A119D
E839F799E1ED0EDA7B0C3AD378A69114
63D446DD7F5FFDAE54E523493BA515A9
0BB19040A1F8A1FF79234189FB7C8A4D
4324C1B2C00C5336EB96CA9208EFDFE9
72ADFEE472E77F6BCC67B977814BBADD
19AE28061C02EC779C40156E5C049AA9
F8654CB7A3D379A603E209F7D6EDAAF9
D0015C3AA782FB3C7924D6801528FD2A
A92F5550010A8756AFADD412A33892BE
FB8900345563EC5F02B4DC08D24770A2
0D9ABF247405996BC3BFAD0885BBD35D
33844237B0DD8802A4DA818FC54AEE7D
1B940A047D3C38E3C6B441457F100B1C
21FBC832D5AA392401C500DA4E5579F8
8F2618D3A5946003D490C190C13D2BD5
F01E3339A63E033EE285D231BE91A6BA
ACBC46620A11A57A8A88C460583BDF2F
228D46AFBEF64BAB3E25646466A71E87
9628B6D4793A0AF31246707B18FABA3E
6D2CB8D018CB143B024F8506E1A75D13
3F122169FD0493E8856063B8B36768E3
0DFCE74EBE732CFDDDF0BCC15DA685EC
E74518E078DF92F6566160D097798737
2AF73BE98589A776794014361C8D30DF
2F0464A9DCCE517BAD7FF61F6FF37E22
79B39FAF63D8A0533D723B814082CFA3
A814D20937C05E4940A5B45B9D7BFB2F
9039CC09E736BEB3DC6A2F721F4DEE96
420DD6B0E4296FA950F76CCAF408D74F
978C489CDCBB511BE51FCCC597CEDEA4
509AC2D92EA4CC9CCC897311C1963729
D5E480E9CD4E9804EC71A014B5FF95F6
75CB319CABD4F0754B0F5E688D32C9BB
DFA61F5F8B55D98A94DBFA88871CE767
2B9C014F8ED3FFF70155AF31AB9B9623
21C2EC88D5E1E9A30A241321ECBA8167
66198458725FF17904A1C32BD27C87CD
0586AFA977F76A35A867E8F7BCAF16E5
F73DF752C616D7FAB3E7D81E8131CBA7
A5D19E31F32515AFA0790DE65D42B57A
91516AD653827091BF9A54761236C91F
293DAAC83DFAD95AFC961E3DFEEBF245
1F81ABC6FB3CD2AAFFAE52821CCA6783
AB8D7DDA45D453D5A79ABC976EA1DA3E
8E7C5C25D49DA1F907BFD47C130405A5
D3AF1A8C8C7449FC39DA5A1F69DAB5FE
34024B118DDBEEBB41647E4A74147BD6
D13420D30C7663F9AF82FE720C1784EC
5E1325A6A85C1B792BE55B943BD9C0A7
D952C8A331DCF50F711209539D6F0B16
06108AB67CB61F6B46AB1CF0A1662394
5449865F405FEC9E3EBCCE2AFBD31FDC
D6559CE70DC6F0D72F5A46D1EBF7D995
7C2331EAD681EC99C4F95161BDA0837A
3E0010DA52D9DEAE9B0A8C87339163D4
0564300CB38C5DEFA27BF3A3D291AB27
BB0C12F7DE34DBD90E8E1A75FECBCFF0
81A527BB60957CF872115F097AE877BE
0A005A6F251F8E1F990013D4DDB83F31
6D578A5649E8A3E9038A8853FA1CFF7E
5E1A77E29199A1F72CF7413207DBA66E
3D70100DF1F741B3C538543EE2C9BCA4
243676058ABA946A51BCAB5620CAFAFD
1594873C2E559E8A5DCC63F25B43D7FC
98A0D8319CF5C9B8F577601C1D2CE456
94FA3436DB9B93ED239C4DFBA78E5C53
51F6EB59A56B664FCD2AE0BCA939DD7C
01D02820D91F2FE47BBC549346C5DCD9
B8C6118DA8D5766921FFCE20E5FEC3D4
301282C59FF11DB8ABEB2CB3BE1A8FFF
F8BE3105C6A729CDBF4B801609AD3CF1
846392D059FE1FEB557E912998FEEED5
F2A2C48E20BB8AED81FEDA2080ECF85D
BDAF0476F4DBDD5A765C01479FFDA8C5
A0494936246F4E539F60C733E0A4DD26
38007524948DAED8176631479EE5ADE0
6A7102100C77662D46240614A179DF5D
A7ED0821CB944260A2369A95B16EAFBE
0F1C4AE8E4831EAB86BDE82EF0E9B919
EBFA0D9B1E897409C143E12EF15B2C0B
3333DF69D40A0F6B60D8312BF3F5E1BF
2BCC0D413E72B73484A21774D617DA15
3A82C087A5AF6A93CB815E9415FF9BB7
BC7B9816A4DC15BDCBB0823DD23EFDCD
A97D4B17A7133E5EEA86E80D122BF3D3
9614ED07C05C4E1DB4B4467FF32EC52F
B6030015EF3284E4BFF56060BF2BB65E
987C57C26A73545B46EDB662FAB3F2E5
849366754DDF708F3AF80EBA4B6448C2
D92632156519ED4331751CFC6F85BE46
DD41ED70FFD730F65FF251D2D6C13EFF
7BF1B147E1AB3BFF22D9D90D48E9FB14
B4857FA2C0B7C4CC0731232826FD1EAF
7B0D53044FED1DDA50F282CC0B8A47C8
F3703DF5A699FB77EE41D868E7A0C5F6
6A495D2813A44C0491F0D01289C34C21
B23E342CE076F3D8BA132ABEE7A48026
D96B2227D7B43994C90069D9BD2FA95D
AA5A10DABF05331E9EAEADA8327D8FA2
2221395AA134EBDC73B571228BC7E4E8
86E20701D84E86DB514783E1B533DBAD
ABA557D8E56476B1455F696695B72FED
3F5FF1006BFBB62EECC2BB74E5E78EF5
F5B240049C7FF563E3C13D46A00F393B
9A5EFC40B8ACCA0D0830A64FEE06C3AA
F94A0D7C272C15CEC47EB0FCD8713962
0091E596C3CFC5AEB8921CCBEA4EC392
DC02F5C853FCF84B07774C31875FA17E
08E0562279E13FC297AC94842B4FF64F
A299C630216F34A1207A97A8B7AB58FC
9E2AE2D60594CECD8A163005D61913AD
591536B1630414402B3CD4F439AC0BF3
8EFF6F10695DFF8F2C3D19ED18945145
B4221906627EB83F2298EFE08D9BDB48
10AB38B3DBEFC4FCACDAC687AA49FF0B
61BF01B2D99EBC70ACA465B621C6ABE7
9F1430292CFF3D39CB869B2BDF17EF19
B0666F03C128EC2ACDAD42DB54A65EBE
93343312FB7ECFE63F30927A1C02DDAE
1C6EB32B2FA352DBDB10654AC0A54AB0
87A98FE6DACB3523F81C52F03F7D9001
900942A1546E3E3744E8EA007425105A
3E890451AD3DA0CACC94D075A324099D
595B0633D3AC14510AC8B647AA25D237
64DC6632BFCEB34EE5A177B73FFC6CEB
1DA89B67F7088FDFBE509C084898CCDB
54F1E23BE76D4EE12F11940D59BE788F
30510B4B07F7E873C7C3C745C595D739
5C67AB9D8507B776CBDED0433CC7A690
40D5361C154627BADD986B43715BE645
511BC2D96A91B5F42A4161B7B0C9FAFE
D4FE02215D2B9A1095985FF3FD8C388A
9D76DF9CC2C7FDFDEC818D85DA7C367C
991ACBD56A4304D2E9C60532DAC4D0F1
A53489F89DEECFEB1B85AD541ACF7B6A
8EE176FAC5C8631F0AAC8F7BB81BEF04
FF99C45217B64F234E64C100991D70BA
AA51FC9F9831772FB5A4942459D4EB4D
CC13DDDBE56413093004AF017CE2C6C1
1457E0CF94C73C57AB1E60F7CB3FF56F
D04972419F618F6B35640044D5ABBF0E
EA91937FDEFE6A5E36596C51EFAC78DC
120D2853F37C8E110B5703D70B7C6EB5
B81692B92BCA5E318245009F868BF545
331C0741AF9A9E8CB71758F4CD2D9D66
6A11256318D1CD6E427A0AE4237E5579
00389C5CAF950B91CC9119C99D570DC7
BC5684A17295EE9A757A8EA1F50FC7B7
2059D1D3FB4E1B82AC4D0944E503C227
B12480E08EE0578529B4032221B48091
807619612CD8D5FA164930F70EBD3FE0
F05D136667FE656B4676B180460E06B1
1D7D11544D3EB5DBA33ED9250D2FAEDB
750FF2AAFC16CCD7057E91338A22A67A
661F8591E94786BAF0A459A4E78FBFC0
47E752B360B367812EFC618349561578
4FC810CC1D022F76CFCF08F944C4B7EC
8D012A9703FEFFFB37C875ECAFA97DDD
D4FBD441BAA777A6300D16A1E2B962FF
4C40C1E1E8A6A5DF661426683A357F10
42D08145B67E0ED01CB2EB31E85701FF
A63E323BE9E2C52F77EFF4509F2EE8D4
C0A1C620966B9B9F247D1D2806749868
03397788508DFD4177988321E8BE1E1E
4A04CA9EBFBE3354B87341501E03C1E3
52F774491ABDC8FE260566F503B31744
CB1243013BEA3FAC5B01C8052DECD1D6
CF707ADC1A47597C0CC454FCF15E7CFC
5F180B6A3CA4BBC3A116FBA6FFD7EA3F
875513D4357BC140C42106BBDDC85E53
602FEC8C7EFB88CA4BE16B1A44E2FA27
C6A2FB57E67B267CC000218FFCCBDADA
41353120FBCC1CA9692AB54ED90FD579
ACEBF43B60BB6C41E235DC857E4628CE
455A44D9794C7E7903C1B8555219E183
E639089DDD1ABF950C31348D0618A491
50D436F07EBD9C35BA82CB5FEEA3EB4A
308859A4D7AFCB1AA7598ABB35EFB5F0
2BE206C4DDA4F3B82E9AA09CE52F6A7D
3095400969CA18990CABD7E55DBFA7CF
25495D0FA372FBDE82D3507F1E465BEA
4A57D00E81BDFDC662A15475EA1AB5F6
5B869CADFC6449E36C0D4FF3A22DAF8F
EE52DDDB21D3BE3D448C30A85DB73CC6
AEA6C2A9FF43A7F634B973414268DE71
50F5612CC3CBBC142EAC0445FF1462E9
91F62B108C13118E303F8CA1182DB6AC
72C21E5CA8657B648EA2462632B2FFA4
6EBCFF6C71057E80727666AC6092DBBE
379A9585FA32BA8A34F75240525FBA60
0FFDAD23D5E504A465C231CE64589A39
0A4CF371981EB74FC5454C8AF6A68FBC
8BC40FABFAF454EE01147532A81EA19B
657D25CDC9AC760940C38EC2467D28AE
E3710E5CE05BDFAB537C3B0AA29476DE
106CDB81392D00050275E8E0FFF3D73E
8A657A23263D172DFE80F55ABA0AD788
3D75AD06FB2182073DB1D56ACD605117
44D1865241DD79F186CE9332BF15CE7D
79A817D86774784A37E816611A4576CB
F886450D896A4FABC7FA9084E383323D
122E73732337E1439953548F56559D36
BBEC0BCAE4B62CC9647BF2C60537F9A9
4011A30EABCEE6959985A4638820EF5A
19A00E1F2CF4804098A3D5D9497F46B6
A61E8096E4E846710CF3544125E2E71D
5EF96D07CD5181E080AC82D2E160C7D5
9E0B4503DB26E0463AE86C38C4824A6D
9A0DC42311F5B63DB0443650D5DFE9F8
C40FCE2C6921CF73599A985841611699
BBBE8C336143865AF225B04613057FFA
0C6613D7E3B0C1F616718EF9421F77D6
04C6975172A64201130527C3CCD57A93
8F977FB63E9CB856B8C92790B64BEA7F
EDC1A64677F29F3D3A543B23A7F6CED8
AE86AA851D07BC4A3C08A8E7E498A05E
98D8906F8750D20A2B4ECD0A15E89C8E
7A9A1A50F739BDF7BF1BAC00C61E7A5F
5A4CA4D0E8EA2911038B4B1397319769
F2CAE55B064C76B5F228068B7722713D
1C968E25B31FAEC5F3895961800E85FB
B045A8D5EFD4E33CB4EB5A6821CF25B4
8D378225879A29368B1BC4D9AC6781E9
5BBDA862D300F7D4B4486A49DA956518
28FE24097C7EC66709B69E764249F7B6
70175FB75C83158E3F74EF287F31B3E4
6B159D8E505BF4CA25F77222569B5D9F
52B9728D5ECE5C23B0D9E2F5553B1FF4
222A4E98FD8AF72B002E0F48D1568FAD
94DE94FB3BF25FCE75680A75E3885F96
7D28AC18BFFF13C809899BC87B7FAF15
BB5C2FAA98FFCBF3C8CD2C05DEEA41CC
5C270FEB173C158939AF9218620FBADB
FA24B5FC4441E1E38B5A209BADFE399F
5C77E7C559ED5FFB34CDFA73F801F4FB
413473C7F8A70B843D8B0898E89F796C
A6F886D35C249EE1376EEA53FFAC94EB
BC37BB359177EB19157CF2440F912FAD
CFFDE06B5A5B1A241C0388535C7C984D
322A422C360E20C428A32D4F848F4E1F
AE4A140DDFB57A8B50CB04CB701F4FB9
70D52B239B2BDE290C17D4D9DA6934C8
0D8CA27D7D4D0A69C55B24D834AA1033
8FC9007F4226DE1310BA3A1B7FC9A596
979A4D3CCC90F2B136EF2E776F24F095
3F8E0A142FBE4DBB790966523713EE95
872024958BD7E65F96A2923AFE2117CF
AAFD0AB23CBA39F44BC7A718558E207E
C1ABE8C3F2D4AAAF1925D22E36360BB2
278E4C712A7C2CC28C9F5E90CBE5AF95
3E64116D2BB2363D923D3112E0E106E9
2A4571DE825D4C5B2A8606230291C33E
754CD47C3F5CE972F68726AD3AE8DEC4
AD8D6BC0E6A3D8333E33C0F8924BBC65
75148241755C37072B560E24B2C42C56
B3B101A5A6C2CAC3EA0B78D5EDDF9625
760535D32E75FB47CAB46A716262F1A1
DC3E92E3E91F4BB6D580F094110A5FB5
809DAA928B332885EA9F1531E5E9FBB8
0162D1034B7D6EE56B4B367B7ED61205
8B1A59755B8C39B3FF360340B6551B7B
90AE9A6BAF3BF0A2EE528D7617C78336
0F3AC4283F1BCDD2C92B5E1818D8CBEC
240CE17267EB78A43B89659C4F31AB62
6AB72ABD6FD8924C21CF43D6B8DC519F
869405942D4E2720DDAEB3DDB6295F69
CC10A6407F80E3927576074C14E51E36
62C801207AD61C44D12E5967B7F743C3
6B28CD19387CEFFAF3D61DD0BBD5E9BF
0A109C3FFE3FB348E2C8C0E775F7A2AD
FADECDDA799E1D536896BAA39D24BF8B
29B0007CA2CB1247770C9171F11BF136
BCD9B8EA7721E3163967768CC016263F
21887A4C8D2CAFA3466419723EAE7376
088CAAC8DBF33BDB9A26C8AB32E2AF5C
0F5F600E9EBFF589C4C67D91E029D65C
230F3EEB16922EF646592C6A5A1D33BB
13CB5CAFF9D8372111E3108121F634E3
DA281125A6228FEE262D62D6611D5BBF
28C9C2B3CBEDD95A10A3555968E3BBE3
C223FDA42768B7B6C8CB128DF961A099
A9EF6E74B873557B1AA59375D1309E2A
829662C54AC88D7951D9B403C7CF558F
4133F055A0784640E3F8A6FF11E78EAF
4197129FC79A74B6F967F6D1FD1F5FB7
CB58D37545CB87E6E42D43682BE695E9
0309CC284F889CFFCFCDD9CBD4BFAA37
02EAEB479B26EBBB98255985AEA80096
4334D940A70C8CFD26F1AB4B27911BD3
D60412AA71EEF08307BFD5AB4F737133
CD0A61458C652B67C943656E72A31A4F
84941A01D546AC8B2D9A652BD2228C0F
20C1DF0174F7B5FC88F5887D65B69B68
4F80C55D794E4B90CCC78E3DCF7B5F56
0AC5AC1564FE8724457D67CCBE8F397A
B63CC2556E1EE943BBA546D3EE8717BB
E30D8F9A1BE9336DD221BBFC7B490136
B4DE2990B81ED0AFBD482563D2339D3F
CFA921E6052CF3BFC7F112BF655C570E
FA2D82D736859DBA98976DD8F11D4E28
BD51D2505705DAB2CF02BA040F6F1CC4
093D9603B6065D5F25118D2679420738
2897277E99C635FDC8689C09D0FFE7E3
E92618FA98E5586E1DC5C7222F0320B4
3575A1244EFA3F79863807018D485EB8
39B20935F2B782F77A515B6BD33E3149
F2D4C204A57BD98585D7D89F691D0087
550E0C76BAAB83318E1C1532A88E5A4E
5B9EDDEEE8EF158860F291AE04DC5CEE
DB94DA0835B455549786BFBA8FE4E678
48C5F98879100E07B0F319384F54932D
0BEF27E677E163D4416F6356ACB5176C
1567DAA98FBCAFFC7703185B7BBE5E41
0F04A28E9F8336E56F880583A8C9998B
447925603CD6EEAEC901CA714B0EB80C
00FA4D5C9DB556BEC47CD570863C1C15
EA3EBD6C0AB1FBA4AB9BA8C0049FC634
5A9EF4C8AAAC436701DC5A5E6D5C8D7B
718D3A011288D36F9200710C5EDCDBCC
8F221B2F7AE7C30897AB22EB3C9126CB
059CDC5FAC775C9AFE8D174BD7B4ED2B
26AB3D00FF7DC45368D689B8615566ED
252AFE760D3CE014A23332F001470A01
992A6DC24DACB89AE9DD5C581A0F301A
CB092684EF336456C74FB3413F4D6C9A
5715F8988EDE4FE63F8C97D93FEF6512
3E87DE1909AE8C9785DF3783286BB5B5
B7A0083C5CEAC640FA80530B975EDA96
AB732E2D142E69EBAA7817B6812BF40F
A7BB5A3973C9FFE6D7DCFB90CAEFA928
B692B4DE97B4FDFA7640955E4A601820
479A35E96DF1B5AD3D570936E7F86D66
9D5C075EDCD978F82D703DA4AD82B39F
35FCD8B77E431F5A02278A8416EF425F
E1DEC607D14498643202589DF77EBB9C
BD8E1DEE9751F757B077730CA5DD799C
C7DA1C4AFE5120C895A2FA83CEE07ECB
B395E661154370FE433B8912269F6A67
9C97B3121D4E0D0475CFBB3483DD1E85
2344DB4F3E16D7D47AD1F152613114F7
36463E5B6E21E87B3748D7C6D0AA0EA1
17F880914B2BBEA65A9962A0CDE1D8C2
3BC54853682C327289501E6BA215890F
574365E9BEBD896C3FDA771EE0B1B3CE
7A090C2ACCC595CFF04DB97486944E10
0A07F4CA1DD4BF6EB88AD9FE7C5234D7
52BE813D8F68F7E7752F9830685367CB
8E2F738CCDF96D036642CCF8F1A35F3F
800BD3630DAA4137F2135A1CFA06BBE7
890E715CB19E7A9A36D328688966F6FA
70C718B48126EB7590B4AF09F41A9201
D8DFA519A97C3789CCC4811EC22FE9E5
048826BA9202CBA3A536FCCD44C01DEB
1B788E3574BF86BE9D84C5D7F660B3CD
CC0C1490FDCF9C489F1AF5D1AF86C86B
A99AF109B5AD14DE402954CE821FB12B
5358E49F4AD540777AE9B2616215426C
4FAC8445FFAD67B2D460129F9E14A747
90200E94D58D94AF9804A40529B5D3DF
5EA8B8615BF865A95F9688F8266A0AFB
241FF5B6A5081CFF694C62733DB35BE9
DA728EF1B099C18DA40893AD62C23D7B
2263BEC1F3252784EEAE81BA732D1B69
5AC5F0AB1E8FFDBB8823A612111219E7
24375B6D45AADDBBE2D870B4C6915D77
CBB089F12157F4B470429516DAB1691D
FB3E450D41ED5462926B09129C8B1DFC
BA59934E4090EE7F8E5ACD1B727A3B26
E75634088DF86609CFC784ABBA814502
5B5B60944ECE3333EC4B5299777AF605
68405A0451C1668ECC4664FDED8DF747
2E9F17072A2BF268D22420752163C4B9
C066713E8290E4835670F21E819B990D
1FE87602796F58A41E7F79E9989F8D33
0AA329ACEE56B2DFD439DA9D03279A83
9AAA456DE96F5B614141BD6872D659B3
AAC814A5A8B47AA742F5ACADA5E819FD
C9B0E7B81ED477E71050B409441647BE
84897A337FE787DD40712D7FEF1819DD
B7E167E94EE9CDBB2A51E50224C4FAA1
FE57829D5E837B1D57643419D20DFEFE
C85D9C21AE69900D7D8EC9012C64E835
A84F650D86ED48D84A082CB0B45F74F1
6BBBE275356E827FE2FF66F931C2E12D
03EBCBF56BDD5DFFB02E9751A7037C40
188B9E6CE04E9D5950FA04BB90BE783A
ED218BF7B1B2C1D8C9D202602F154060
A0434AA985E6F44B07F829F2B0191BEF
C1F74203A1C1134FAF5635E3C95F9C56
60526F5CF8C228726CE1698ADB9ED7AF
8F11800FE9328CE801530F5A218DA23F
DDB4BC3E5BA439C13EAA25F87C2E8F9A
C9CD588CE1859FB3A82A45407B8B52B7
03EBBC786E4EF9DF153F77FC866BB3FF
95C5EE483EED57FF5A8D0413F4ECEE9C
AA4432A55FAD9EB73F7EA8E0AF1D204A
18237350E0F27D9CA77094F6506E3E99
D6EC4304C91CCF4638B23089AD4FB1AB
0E22ABA82E91F653A691AA333AC085FB
9F81F78A3C8DFF57919258AD1145338B
7BAE9E408E093F731665F4F6BBC6DAED
170ED48BFC275A3AB8DA1D0811C310FC
36FD2EDA66CCFADE06702E89CF5E98FB
4890FD974579AC260433F6CBDA8E2B52
37BADB3FC56B9AB5415CC34E5DA38DA7
FB57A480CC8F4DFA6F4F8D1196FA159E
7B04F33EB9DAD71C803158C5EDAB378D
5604F65CAB40D39B837FD84D2A93DA62
2245242ABF81D47238B65CAC656B78D6
A033E0B0123613C49B89295103B68302
C0F70853FB5C2887DAF25C68473A72EF
B9A2E526BBE22B5514A7DB6B13DF083D
1B27DA6ABB5C76B38C188054A2B6BED4
FAE466A86792AA5600C18156B4F2CFA9
306979C926453BFEA2A9B054A17007D2
00000000000000008802002000000000
000000003D0700003207000000000061
4BF09CBA0000000000000000E0FF0320
E8FF032049070000F0FF03205B070000
0000000000000000000000008F020000
ACCE55ED00005000

00000C0010000020

04F0FF7F01000000

00ED00E028ED00E0

0000000000000000

0000000000000000

0000000000000000

0000000000000000

0000000000000000

0000000000000000

0000000000000000

0000000000000000

2502000001020000

28ED00E03CED00E0
00000100000000400000000034ED00E0
38ED00E0

But now I get a different error:

Reading symbols from ./_build/nrf52840_xxaa.out...
Remote debugging using | ./CrashDebug --elf ./_build/nrf52840_xxaa.out --dump crash.txt
ERROR: The dump file failed to load RAM memory region at 0xED55CEAC - 0x00500000.
Encountered unexpected error: 30
Remote connection closed
No stack.

I do not fully understand where the 0xED55CEAC - 0x00500000 addresses are coming from. That is not what the memory region did specify.

adamgreen commented 4 years ago

It looks like your problem probably started around here in the dump:

ACCE55ED00005000

00000C0010000020

The ACCE55ED bytes in the dump corresponds with the 0xED55CEAC region address noted in your error text. I place this stream of bytes in the dump if I have detected a stack overflow while running the dump code. The CrashCatcher stack is probably not large enough to run your dumping routines. You should try increasing CRASH_CATCHER_STACK_WORD_COUNT to have it work in your environment.

git-dimiz commented 4 years ago

Thank you for the hint. So I think there is something strange happening with the dumpMemoryRegions function

static void dumpMemoryRegions(const CrashCatcherMemoryRegion* pRegion)
{
    while (pRegion && pRegion->startAddress != 0xFFFFFFFF)
    {
        /* Just dump the two addresses in pRegion.  The element size isn't required. */
        CrashCatcher_DumpMemory(pRegion, CRASH_CATCHER_BYTE, 2 * sizeof(uint32_t));
        CrashCatcher_DumpMemory(uint32AddressToPointer(pRegion->startAddress),
                                pRegion->elementSize,
                                (pRegion->endAddress - pRegion->startAddress) / pRegion->elementSize);
        pRegion++;
    }
}

After the first round where it dumped the region 0x2003E000 - 0x20040000 the pRegion->startAddress = 0xED55CEAC and the function continues to dump that stuff. So I don't relay understand why pRegion->startAddress != 0xFFFFFFFF is a valid stop condition.

git-dimiz commented 4 years ago

Ahh now while i was typing I understand.

const CrashCatcherMemoryRegion* CrashCatcher_GetMemoryRegions(void)
{
    static const CrashCatcherMemoryRegion regions[] = 
    {
        {0x2003E000, 0x20040000, CRASH_CATCHER_BYTE},
        {UINT32_MAX, UINT32_MAX, CRASH_CATCHER_BYTE} /* END OF LIST */
    };
    return regions;
}

That did the trick :)!

adamgreen commented 4 years ago

Sorry, that is my fault. Should be:

const CrashCatcherMemoryRegion* CrashCatcher_GetMemoryRegions(void)
{
    static const CrashCatcherMemoryRegion regions[] = 
    {
        {0x2003E000, 0x20040000, CRASH_CATCHER_BYTE},
        {0xFFFFFFFF, 0xFFFFFFFF, CRASH_CATCHER_BYTE}
    };
    return regions;
}

The 0xFFFFFFFF region is the list terminator.

adamgreen commented 4 years ago

That did the trick :)!

Excellent. I sent my previous response before seeing your updated one where you figured out the same.