exception with gdb and raise.c lazarus / 1-Linux ---------------------------------------------------------------------- LArgonnais · 2023-07-09 13:47 Hello. New distribution, new installation of Lazarus, and first issue of the usual long list of issues in such a case. When I run the program what was running before (upgrade made because a lot of thing were missing in the previous installation/version) I get this exception: QuoteThe project has raised an exception "External SIGABRT'. in the file "../sysdeps/unix/sysv/linux/raise.c" at line 50 Then a second message: QuoteThe file "/build/glibc- SzIz7B/glibc-2.31/sysdeps/unix/sysv/linux/raise.c" was not found. do you want to find it manually? Seems to be an issue with gdb but the fix found on stackoverflow didn't change anything. I cannot find this path on my computer. More. I just tried to create a new project with a single button and there was no issue that time. So: − some bad settings of the project written on previous Lazarus version? − an issue with some unit/package not yet properly installed but that compile (how!?)? Any idea? Thanks. Lazarus 2.0.6 Linux Mint ---------------------------------------------------------------------- Martin_fr · 2023-07-09 14:37 Does your app (compiled with the new Lazarus) run outside the IDE (or in the IDE: "run without debugger")? I can only assume that something included in your app loads some library from the distro, and that this library has debug info and included the file "raise.c". So now when the app/library fails there, the debugger knows the filename, even though you (most likely) do not actually have that file. Not sure if the debugger is showing you any stacktrace (stack window). Maybe the caller list gives a clue. If this fails without debugger too, then more clues are needed. If this fails only in the debugger, then... 1) Are you using the gdb debugger? new distro => new gdb version... maybe 2) Have you tried FpDebug? QuoteLazarus 2.0.6 Have you tried 3.0.RC1 ? ---------------------------------------------------------------------- LArgonnais · 2023-07-09 23:09 No, it doesn't run outside the IDE, even if it is compiled without the debugger. I get this error Quotefree(): invalid pointer Abandon (core dumped) What happens is I have the following code Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     Region := TRegion.Create;    try      Region.Handle := CreateRoundRectRgn(0, 0, Width -1, Height -1, 50, 50);      SetShape(Region);    finally    Region.Free;    end;   and first, it failed on the Region.Handle line. Then the raise.c issue comes. When I comment this line and compile, it works in the IDE with or without the debugger. Outside I have tested only without and it worked. To be more precise about the bug. First comes the first message (exception … at line 50) Then it asks to search it. If I say no and run again, the program ends (SIGABRT exception). If I search for the file I have managed to install, it simply opens it up in the IDE and points on this line; when I run further again, I get the SIGABRT signal. And finally all I get later is this SIGABRT message. I get the file following Mark Plotnick answer on stackoverflow. I am puzzled about this folder /build/glibc- SzIz7B/glibc-2.31/sysdeps/unix/sysv/linux/ I cannot find it anywhere. Even /build/ Quote from: Martin_fr on July 09, 2023, 04:37:58 pmNot sure if the debugger is showing you any stacktrace (stack window). Maybe the caller list gives a clue. Here it is. The line that raise the exception starts at #8 below. It is in the create method of the control I want to display. Quote#0 __GI_raise(6, 6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 __GI_abort at abort.c:79 #2 __libc_message(do_abort, do_abort, 0x7ffff7596298 '%s'#10, 0x7ffff7596298 '%s'#10) at ../sysdeps/posix/libc_fatal.c:155 #3 malloc_printerr(0x7ffff75944c1 'free(): invalid pointer', 0x7ffff75944c1 'free(): invalid pointer') at malloc.c:5347 #4 _int_free(, , 0) at malloc.c:4173 #5 gdk_region_polygon at :0 #6 CREATEELLIPTICRGN(0x7ffff67c2230, 0, 0, 0, 0) at gtk2winapi.inc:1330 #7 CREATEROUNDRECTRGN(0x7ffff67c2230, 0, 0, 0, 0, 0, 0) at include/intfbasewinapi.inc:229 #8 CREATEROUNDRECTRGN(0, 0, 0, 0, 50, 50) at include/winapi.inc:165 #9 CREATE(0x7ffff53f43d0, 0x1, 0x7ffff68002b0) at testtransparenceshape.pas:38 #10 FORMSHOW(0x7ffff68002b0, 0x7ffff68002b0) at unit1.pas:710 #11 DOSHOW(0x7ffff68002b0) at include/customform.inc:1019 #12 CMSHOWINGCHANGED(0x7ffff68002b0, {MSG = 45081, UNUSEDMSG = 0, WPARAM = 0, LPARAM = 0, RESULT = 0}) at include/customform.inc:649 #13 SYSTEM$_$TOBJECT_$__$$_DISPATCH$formal at :0 #14 .Ld95 at :0 #15 .Ld94 at :0 #16 ?? at :0 #17 ?? at :0 #18 ?? at :0 #19 ?? at :0 #20 ?? at :0 Well, I am wondering, as it is a memory error on a function from winapi, maybe in any way, this is a major error that must stop the program. I tried to raise another exception and… it frozed my computer. But just before, it didn't react the same way. I tried again by raising an exception and this time it seems to go through, without the raise.c error. Quote from: Martin_fr on July 09, 2023, 04:37:58 pmIf this fails only in the debugger, then... 1) Are you using the gdb debugger? new distro => new gdb version... maybe 2) Have you tried FpDebug? Yes, everything new from this morning except my data. I use the config update at first use of Lazarus. Seems to be OK. I tried FPDebug also, and it didn't change or was even worse. Well, new installation. All data copied back (no home partition, second hand and small disk, and sold like that). Ended in the middle of the night and only version 2.0 in the repository… I am wondering… upgrade everything again or give me a while…    In summary, what do you think of: − bad idea to call a winapi function on Linux → you get the raise.c curse, − with a more convenient exception, we can get through and avoid the curse. Hope that helps. (I made some tests while writing, sorry if it is long for such a conclusion). ---------------------------------------------------------------------- Martin_fr · 2023-07-09 23:41 Ok, I try to answer what I can, but basically the actual issue you have is outside my area of expertise. I got in an "gdb" => because I deal with the debugger. But the debugger is fine in this case, it just shows the error that happens in your app. And the file raise.c not found => not an issue. You are calling gdk, and there is debug info for gdb, and that contains that gdb was compiled with a file raise.c => but you don't have (and don't need) that source. Unless you want to debug gdk itself. So it looks like gdk tries to free some memory, and that pointer is wrong. But if so, then this may be a bug in gdk.... The call - from "CREATEELLIPTICRGN" (gtk2winapi.inc:1330) in Lazarus - to gdk_region_polygon has nothing that point to memory that would be freed by the function. I can only think that the function may free some data of its own.... But that wouldn't be in our control. Again, gdb not my area of expertise => so maybe someone else knows more. Quoteand first, it failed on the Region.Handle line. What error did you get there? If that error corrupted memory, then the 2nd error would be caused by it. While I might not be able to help much further, if it is memory related, try running the code in valgrind --tool=memcheck --log-file=laz.trc  ./yourapp You need to build your app with -gv ---------------------------------------------------------------------- Martin_fr · 2023-07-10 09:25 I just noticed, your region is zero sized. QuoteCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  CREATEROUNDRECTRGN(0, 0, 0, 0, 50, 50) at include/winapi.inc:165 x1,x2,y1,y1 all zero. ---------------------------------------------------------------------- Martin_fr · 2023-07-10 09:41 However, while you got code that crashes, you could try First only https://gitlab.com/martin_frb/lazarus/- /commit/dbaca5b3a9c6fc8e918300e519f5bef478babc98 and then the above and also https://gitlab.com/martin_frb/lazarus/- /commit/bd9b09f5e087a50cc048b262ed41893ce2d6cc27