From: Fritz W. <fr...@sp...> - 2011-05-16 11:18:36
|
Hi guys, I am trying to learn x86 assembly with NASM since it uses the less hideous Intel syntax! However the debugger front end I tried doesn't seem to recognize this format and I can't set breakpoints. Whoever is using NASM on Linux can you explain your environment a bit, what tools should I be using etc. for best results. Thanks guys. |
From: Jakob B. <jb...@wi...> - 2011-05-16 12:34:45
|
On 16-05-2011 12:57, Fritz Wuehler wrote: > Hi guys, I am trying to learn x86 assembly with NASM since it uses the less > hideous Intel syntax! However the debugger front end I tried doesn't seem to > recognize this format and I can't set breakpoints. Whoever is using NASM on > Linux can you explain your environment a bit, what tools should I be using > etc. for best results. Thanks guys. > I have not debugged nasm code on Linux, so I have no specific advice for you, but here are some general info to help you along: Hmm, maybe it is not the nasm format, but the debug information format that is the problem. As on all platforms, there are different file formats that compilers, assemblers etc. can use to tell debuggers which code bytes in the output file correspond to which lines in your source code file and what the name of that file is. In the case of Linux/Unix/GNU tools it may also be mandatory to include NASM directives to mark the beginning and end of each named function, as gdb seems to be overly focused on checking that information before looking at anything real. Anyway, most current Linux tools use the GNU DWARF debug information format, I don't know if NASM includes DWARF information in its elf32 output files. |
From: Anonymous <cr...@ec...> - 2011-05-16 15:50:35
|
You wrote: > On 16-05-2011 12:57, Fritz Wuehler wrote: > > Hi guys, I am trying to learn x86 assembly with NASM since it uses the less > > hideous Intel syntax! However the debugger front end I tried doesn't seem to > > recognize this format and I can't set breakpoints. Whoever is using NASM on > > Linux can you explain your environment a bit, what tools should I be using > > etc. for best results. Thanks guys. > > > I have not debugged nasm code on Linux, so I have no specific advice for > you, but here are some general > info to help you along: > > Hmm, maybe it is not the nasm format, but the debug information format > that is the problem. As on all platforms, there are different file > formats that compilers, assemblers etc. can use to tell debuggers which > code bytes in the output file correspond to which lines in your source > code file and what the name of that file is. Thank you. I finally found a problem was reported on the insight front end to gdb back in 2009 causing a segfault, looks like it was never fixed. So I am using ddd for now, it's not as pretty as insight but it doesn't crash LOL. I finally found where to say Intel format instead of ATT so now I am doing better. I'm so happy about NASM, how can anybody stand to use ATT format or gas? It's a crime against humanity! > In the case of Linux/Unix/GNU tools it may also be mandatory to include > NASM directives to mark the beginning and end of each named function, as > gdb seems to be overly focused on checking that information before looking > at anything real. I will try and remember this. At the moment I'm writing just a few instructions to try and learn and go through the book. > Anyway, most current Linux tools use the GNU DWARF debug information > format, I don't know if NASM includes DWARF information in its elf32 > output files. I was reading a book that said to use stabs debug info but I will try and see if I can use dwarf and get better results. I am using elf64 format at the moment. |
From: Jakob B. <jb...@wi...> - 2011-05-17 08:38:23
|
On 16-05-2011 17:34, Anonymous wrote: > > Thank you. I finally found a problem was reported on the insight front end > to gdb back in 2009 causing a segfault, looks like it was never fixed. So I > am using ddd for now, it's not as pretty as insight but it doesn't crash > LOL. I finally found where to say Intel format instead of ATT so now I am > doing better. I'm so happy about NASM, how can anybody stand to use ATT > format or gas? It's a crime against humanity! > Note that recent versions of gas have started to support Intel syntax too. That pseudo-Motorola syntax was indeed an abomination. |
From: Frank K. <fbk...@zy...> - 2011-05-16 14:41:18
|
Fritz Wuehler wrote: > Hi guys, I am trying to learn x86 assembly with NASM since it uses the less > hideous Intel syntax! However the debugger front end I tried doesn't seem to > recognize this format and I can't set breakpoints. Whoever is using NASM on > Linux can you explain your environment a bit, what tools should I be using > etc. for best results. Thanks guys. There was recently some discussion of debuggers for Linux on the Nasm Forum: http://forum.nasm.us/index.php?topic=1056.0 You don't say what debugger front end you tried, but ASSuming it's for gdb... 1)It seems to help to start with a "nop" right after the "_start:" label. If you're starting with "main", so that the "_start:" label is elsewhere, this may not help. 2)Give Nasm "-F dwarf" on the command line. The default is "stabs" if you just use the "-g" switch. I honestly don't see any difference, but "dwarf" is the "native" format, and is supposed to be "better". 3) Don't give ld the "-s" switch, of course, or it'll strip the debug info back out. :) 4) Nasm's "local label" syntax doesn't play nicely with gdb. You can use local labels, but don't expect to tell gdb about 'em - it thinks you're trying to reference a member of a structure! If none of that helps, tell us more about exactly what you're doing, and what's happening. Best, Frank |
From: Fritz W. <fr...@sp...> - 2011-05-16 20:07:21
|
You wrote: > Fritz Wuehler wrote: > > Hi guys, I am trying to learn x86 assembly with NASM since it uses the less > > hideous Intel syntax! However the debugger front end I tried doesn't seem to > > recognize this format and I can't set breakpoints. Whoever is using NASM on > > Linux can you explain your environment a bit, what tools should I be using > > etc. for best results. Thanks guys. > > There was recently some discussion of debuggers for Linux on the Nasm Forum: > > http://forum.nasm.us/index.php?topic=1056.0 I'll have a look, thanks. > > You don't say what debugger front end you tried, but ASSuming it's for > gdb... Sorry about that! New as I am to Linux development I ASSumed there was only gdb! > > 1)It seems to help to start with a "nop" right after the "_start:" > label. If you're starting with "main", so that the "_start:" label is > elsewhere, this may not help. > > 2)Give Nasm "-F dwarf" on the command line. The default is "stabs" if > you just use the "-g" switch. I honestly don't see any difference, but > "dwarf" is the "native" format, and is supposed to be "better". I've been using stabs but as you and the previous poster said dwarf, I'll start using that instead. > > 3) Don't give ld the "-s" switch, of course, or it'll strip the debug > info back out. :) Right :-) > > 4) Nasm's "local label" syntax doesn't play nicely with gdb. You can use > local labels, but don't expect to tell gdb about 'em - it thinks you're > trying to reference a member of a structure! Good to know. > > If none of that helps, tell us more about exactly what you're doing, and > what's happening. Thank you. |