From: Frank K. <fbk...@ve...> - 2008-04-03 22:10:52
|
ivanatora wrote: > Frank, I've tried that source on several machines and it gets killed > on both of them. These include kernel versions: > 2.6.23.9 > 2.6.21.5 > 2.6.12.4 Oh, oh! > I've tried your code and it runs perfect. I even replaced mov eax, 1 > with mov al,1 and it still works. I removed nops and it works. Removed > even the .data section and it works. > I've moved back to my code and tried something else. I removed > the .bss section and the program didn't get killed! > So mov al,1 is working at all :) > I replaced the .bss section with: > section .data > x db 0x1 > and the program is not getting killed. Stranger and stranger! Your original code had a variable in .bss, and you could write to it once, but not twice, right? So it isn't an "absolute prohibition" on .bss. In that case, the size of .bss didn't change, but its position did, and alignment(?). Default alignment for .bss is 4 - might try "section .bss align=16" or 64, or even 4096. I like "trial and error", but this is ridiculous! The answer's in the source, somewhere... I've advised the "nasm-users" list at SF about this. I'll cc this to 'em, just to update 'em on the kernel versions. I was hoping this was a "one time" deal, but I guess not... I'm completely baffled! > Now I'm loading AL or AX or EAX, even doing division :) > Btw, how can I see the contents of a variable in gdb? I can see > registers with "info registers", but I want to see what x is look like. (assemble with the "-g" switch!) "print x", apparently. (printf, too, apparently, but it's complaining about my format string having a missing '"'!) You might be interseted in this: http://www.ffnn.nl/pages/articles/linux/gdb-gnu-debugger-intro.php And/or: http://linuxfocus.berlios.de/English/July2004/article343.shtml (thanks again, Nathan!) Besides "man gdb" and "info gdb", a google for "gdb tutorial" finds a flock of 'em. If you *really* want to get into gdb: http://www.ffnn.nl/pages/articles/linux/gdb-gnu-debugger-intro.php But I don't think gdb is going to help with this problem(?). Best, Frank |