Re:Optimizing compilers reload vector constants needlessly
by astrange on Tuesday December 06, 2022 @06:33PM
(#33888620)
Sure, but gdb doesn't know what the function parameters are, or on some platforms where functions start and end, crashes don't have source lines, and ASan doesn't work. (though of course valgrind does)
Re:Optimizing compilers reload vector constants needlessly
by bitwalker on Wednesday December 07, 2022 @08:41AM
(#33894206)
If you are handwriting the function in assembly, you'll know what registers hold the function parameters, what types of values they are supposed to be, and with care, you can produce debug information and CFI directives to allow for stack unwinding, it's just annoying to do - but that's just the tradeoff you make for the performance improvement I suppose.
Re:Optimizing compilers reload vector constants needlessly
by variadix on Wednesday December 07, 2022 @03:33PM
(#33899842)
I don’t know if this is frowned upon or not among assembly programmers, but I often just use naked functions in C with asm bodies, which gdb will provide the args for, rather than linking against a separate assembly file.
Re:Optimizing compilers reload vector constants needlessly
by saagarjha on Wednesday December 07, 2022 @05:13AM
(#33892682)
If you write your assembly to look like C code GDB is more than happy to provide you with much of that to the extent that it can. In particular, it will identify functions and source mappings from debug symbols.
Pipelining and optimisations can make the intrinsics a bit fucky though, have to make sure it’s -O0 and a proper debug compilation.
I have line by line debugged raw assembly many times. It’s just a pain to initially set up. Honestly not very different from c/c++ debugging once running.