24 August 2023, 12:35 | #1 |
Registered User
Join Date: Aug 2019
Location: PL
Posts: 15
|
Debugging illegal memory access
I'm working on a bsdsocket client. I have a problem though because it crashes the system (guru) when executing connect(). The funny thing is that it crashes only if the server I'm trying to connect to is down. If it's up - connect() succeeds without an issue.
I ran Enforcer and got the following hit: Code:
Alert !! Alert 81000005 TCB: 681B0530 USP: 681B1084 Data: 000005C8 68000010 681B12AC D01B6074 FFFFFFFF 00000001 00000001 81000005 Addr: 68000000 681AFBB8 681AFA38 6800E484 000014B6 681B1278 00001588 -------- Stck: 00F81D38 000000FF 6818103C 00F81D64 00FA71A8 FFFFFFFF 68186D18 6800E484 Any tips for debugging a situation like this will be appreciated! |
24 August 2023, 12:52 | #2 |
Registered User
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 56
Posts: 2,134
|
Trashing memory, seems to be too small allocated memory area than necessary, or you free memory first and later use this memory area.
|
24 August 2023, 15:17 | #3 | |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,504
|
Quote:
It might then only detect the memory trash when you close the connection again. In terms of debugging tools, this sounds more like a use case for MuForce + MuGuardianAngel which may also report what was written into the memory, and where it was allocated, but such issues are often resolved by a code review. That is, wait one day, then carefully read the sources again and think about what exactly what each step does. |
|
24 August 2023, 15:25 | #4 |
Registered User
Join Date: Jan 2005
Location: UmeƄ
Age: 44
Posts: 962
|
Calling bsdsocket.library functions can use quite some stack and different amounts depending on what it does.
If you are using the stack to some extent in your code, try increasing the stack size above the standard 4kB and see if it solves the problem, it is a very cheap thing to test. |
24 August 2023, 17:34 | #5 |
Registered User
Join Date: Aug 2019
Location: PL
Posts: 15
|
Thank you All for your suggestions!
@patrik Increasing the stack was the first thing I tried. No luck though. @Thomas Thanks to MuForce + MuGuardianAngel (and probably SegTracker) I managed to find out that the problem is caused by another part of my program. I got some warnings about timer.device (which I also use). When I commented out my timer code the problem disappeared. Now on to debug the timer code |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
illegal memory access not working | jotd | support.WinUAE | 10 | 20 June 2024 10:35 |
memory access speed question | Lord Riton | Coders. General | 42 | 27 February 2019 14:26 |
68040 memory access | phx | Coders. Asm / Hardware | 4 | 10 June 2017 18:32 |
Break on Memory Access? | Khyron | support.WinUAE | 3 | 21 August 2010 00:10 |
access emulated memory | ara | support.WinUAE | 6 | 03 April 2010 13:05 |
|
|