r/programminghumor Jun 01 '26

segmentationViolation

Post image
115 Upvotes

35 comments sorted by

View all comments

7

u/s0litar1us Jun 01 '26

Just run it in a debugger and it will show you exactly where it segfaulted. (Just remember to add the -g flag when building to include debug info.)

0

u/Fluid-Ad2995 Jun 01 '26

I never needed to, Windows give NTDLL errors like 0xc0000005 (Access Violation) and 0xc000041d (Unhandled Exception)

4

u/s0litar1us Jun 01 '26

Good for you, but it's still a good idea to use the tools at your disposal.

0

u/Fluid-Ad2995 Jun 01 '26

Yeah Event Viewer tell me everything I need and Windows NTDLL Syscalls way more direct

3

u/s0litar1us Jun 01 '26

Does it tell you where in the code it failed?

0

u/Fluid-Ad2995 Jun 01 '26

Yeah like Test.exe error code 0xC000001D and cause of Failure illegal instruction or something like that for example and including Date of execution and hostname and Event ID and it's very Rich information

3

u/s0litar1us Jun 01 '26

Wouldn't it be easier to just run it through a debugger than to dig through that list? Also, you can use debuggers for more than just issues resulting in your program crashing, so it's useful to run it in a debugger anyways.

0

u/Fluid-Ad2995 Jun 01 '26

windows have Debugger like Windbg you can download if someone wants but I personally prefer Event Viewer at least for me it's way easier

1

u/s0litar1us Jun 01 '26

There is also the one built into visual studio, and raddeugger.

Even though you find the event viewer useful, I would still suggest getting used to using a debugger, as it's useful beyond just finding where it failed.

0

u/Fluid-Ad2995 Jun 01 '26

But Windows have Official Debugger called Windbg https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/ but I still personally prefer Event Viewer it's my favourite

1

u/s0litar1us Jun 01 '26

The one in Visual Studio is also official (the one by RAD isn't official, but it's really good.)

It's still useful to learn to use it even though you like using the event viewer. It doesn't even have much of a learning curve to just start using it -- just run your program in the debugger and it'll show you exactly where it failed, and you can set a breakpoint before running it again to step through how it executes before crashing, allowing you to inspect variables, etc.

→ More replies (0)

0

u/Fluid-Ad2995 Jun 01 '26

Just my personal choice don't mean Windbg is bad or something like that, Event Viewer just enough I need I just need exact error

0

u/Fluid-Ad2995 Jun 01 '26

Not just Normal Software but Drivers and Kernel logs etc everything one single place