flat assembler
Message board for the users of flat assembler.
Index
> Linux > [solved] why "call SDL_Quit" segfault? |
Author |
|
revolution 23 Jan 2019, 11:22
Does the function "SDL_Quit" expect any parameters passed into it on the stack?
|
|||
23 Jan 2019, 11:22 |
|
ginere 23 Jan 2019, 11:37
no, sdl_quit is defined like this in sdl source:
void SDL_Quit(void) |
|||
23 Jan 2019, 11:37 |
|
revolution 23 Jan 2019, 11:52
Where is the segfault? In the SDL library, or in other code?
|
|||
23 Jan 2019, 11:52 |
|
ginere 23 Jan 2019, 12:18
if i put print functions above and below the sdl_quit, the bottom print does not execute, so it means it crashes inside SDL_Quit, I dont know how to use gdb, but it says this:
Code: Thread 1 "b" received signal SIGSEGV, Segmentation fault. 0x00007ffff729d7a7 in ?? () from /usr/lib/libxcb.so.1 (gdb) backtrace #0 0x00007ffff729d7a7 in ?? () from /usr/lib/libxcb.so.1 #1 0x00007ffff729e338 in ?? () from /usr/lib/libxcb.so.1 #2 0x00007ffff72f999f in ?? () from /usr/lib/libX11.so.6 #3 0x00007ffff72f9b21 in ?? () from /usr/lib/libX11.so.6 #4 0x00007ffff72f9e1d in _XEventsQueued () from /usr/lib/libX11.so.6 #5 0x00007ffff72fcc06 in _XGetRequest () from /usr/lib/libX11.so.6 #6 0x00007ffff72e094b in _XGetWindowAttributes () from /usr/lib/libX11.so.6 #7 0x00007ffff72e0b3a in XGetWindowAttributes () from /usr/lib/libX11.so.6 #8 0x00007ffff7f400c7 in ?? () from /usr/lib/libSDL2-2.0.so.0 #9 0x00007ffff7f0579d in ?? () from /usr/lib/libSDL2-2.0.so.0 #10 0x00007ffff7f087c8 in ?? () from /usr/lib/libSDL2-2.0.so.0 #11 0x00007ffff7f08b95 in ?? () from /usr/lib/libSDL2-2.0.so.0 #12 0x00007ffff7e85525 in ?? () from /usr/lib/libSDL2-2.0.so.0 #13 0x00007ffff7e856e8 in ?? () from /usr/lib/libSDL2-2.0.so.0 #14 0x00005555555554c2 in main () (gdb) |
|||
23 Jan 2019, 12:18 |
|
ginere 23 Jan 2019, 12:28
the instruction at 0x00005555555554c2 is "pop rax" just below the SDL_Quit
|
|||
23 Jan 2019, 12:28 |
|
ginere 23 Jan 2019, 12:30
i miss those dos days.. if was so easy to do gui in assembly... this linking with various c libs to draw basic graphic on screen is complex and so hard..
|
|||
23 Jan 2019, 12:30 |
|
ginere 23 Jan 2019, 12:31
i will post the minimal code that shows this problem..
|
|||
23 Jan 2019, 12:31 |
|
ginere 23 Jan 2019, 13:12
ok it seems to work now, in every procedure that calls sdl functions i added
Code: push rsp and rsp, -$10 and Code: pop rsp at the end it seems those sdl functions require aligned stack? |
|||
23 Jan 2019, 13:12 |
|
revolution 23 Jan 2019, 14:56
ginere wrote: ok it seems to work now, in every procedure that calls sdl functions i added |
|||
23 Jan 2019, 14:56 |
|
ginere 23 Jan 2019, 16:16
ah yes.. sorry.. brain melt.. will save it another reg...
replaced it basically with stack frame: Code: push rbp mov rbp, rsp and rsp, -$10 and at the end Code:
mov rsp, rbp
pop rbp
|
|||
23 Jan 2019, 16:16 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.