33 ms·
Basically, "dump tons of time" will probably involve some aspect of becoming a C programmer. The program has some kind of portability bug or bugs that make it
by kazinator 5y ago
Basically, "dump tons of time" will probably involve some aspect of becoming a C programmer.
The program has some kind of portability bug or bugs that make it sensitive to the compiler. That the old executable works probably means that it's not a library or environment issue, though that can't be ruled out 100% because an executable from Debian 3 may be using compatibility functions in glibc that a Debian 11 executable wouldn't use.
A C programmer would just debug this on that platform where the problem reproduces.
There are tools which can help pinpoint the origins of behavior that leads to a crash.
- compiling the code with the "undefined behavior sanitizer a.k.a. ubsan" using -fsanitize=undefined.
- compiling the code also with the "address sanitizer (asan)" using -fsanitize=address.
- using valgrind on it
Of course you have the debugger gdb, and the printf function.
Interestingly, the project isn't using optimization (-O0 is specified in the CFLAGS of the root Makefile) so the failure is likely not coming from that class of issue whereby clever optimization defeats the programmer's incorrectly expressed intent.
- mikewarot 5y ago> Basically, "dump tons of time" will probably involve some aspect of becoming a C programmer. Yep, I figured as much. I want this thing to exist, and be multi-platform, and supported... so I'm willing to do that.
- chrsig 5y ago+1 for all of this! Other things that may help find issues: * the -pedantic -Wall -Werror flags * building with -ggdb3, run the program via gdb. With any luck it will lead you to a stack trace
- kazinator 5y agoP.S. turn on -O2 optimization; it could flush out some more warnings. For instance, I think, unused local variables aren't diagnosed without optimization. That could hide a bug (because the intent was to use the variable, but it was misspelled, landing on a different variable). Basically, you don't get all the diagnostics you could be getting at -O0 (zero) optimization.