Recent

Author Topic: Debug External SIGSEGV  (Read 1406 times)

adderthorn

  • New Member
  • *
  • Posts: 19
Debug External SIGSEGV
« on: July 08, 2019, 09:53:13 pm »
Hi Everyone,

Maybe I'm missing something obvious, but I'm hoping I'm not and maybe someone can help me. I'm using Windows 10 and have written an application to parse XMLs. It's giving me an External SIGSEGV error sometimes under certain circumstances and I want to debug. My issue is that when I get this error, lazarus will show the Assembler window but nothing else. Of course I could throw some debug statements in places in my code, but it would be nice if I could get lazarus to give me some stack trace of some sort to help me troubleshoot. Is this possible? I did see this bug: https://sourceware.org/bugzilla/show_bug.cgi?id=10004 but I'm unsure if it's related.

Any pointers or help would be much appreciated!

440bx

  • Hero Member
  • *****
  • Posts: 6149
Re: Debug External SIGSEGV
« Reply #1 on: July 08, 2019, 09:57:28 pm »
go to "View"/"Debug Windows"/"Call stack"

you'll see in the call stack window the function/procedure that caused the SIGSEGV.

HTH.
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12202
  • Debugger - SynEdit - and more
    • wiki
Re: Debug External SIGSEGV
« Reply #2 on: July 08, 2019, 10:01:08 pm »
What is in the thread window (Open it from the view > debug menu). Also open the stack window.

Make each thread "current", and observe the stack.

If you are in luck, one of the threads has a stack.
If not, then maybe your app overwrote the stack. In that case at the time of the error, there simply is no info available, because whatever lead to the error, did so by destroying that info.

There is an extremely minor chance that gdb is unable to get info, and another debugger could.
It might be worth getting the latest gdb https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2064%20bits/Alternative%20GDB/
You could also try fpdebug, but that is least likely....

If you have Linux (in a virtual machine) then you can try (google) valgrind. That tool is extremely good for that kind of error.

adderthorn

  • New Member
  • *
  • Posts: 19
Re: Debug External SIGSEGV
« Reply #3 on: July 10, 2019, 02:49:50 am »
Oh my! You guys are the best. It was something obvious! Thanks for the tips! I'm still struggling to debug, but at least I'm not totally lost looking at assembly code I don't understand!

 

TinyPortal © 2005-2018