Author Topic: Memory debugger in SASM not working? (NASM on Linux without gcc)  (Read 1763 times)

Offline 0xDEADBEEF

  • Jr. Member
  • *
  • Posts: 7
Hey folks! :)

I recently started getting into ASM and the very low level instructions of a computer and I'm planning to code a basic virtual machine for my own ASM syntax for a system on a micro-controller. For this I try to study ASM coding in general, the generated binaries and how the memory behaves on runtime. I feel pretty safe with the first two parts but what I need is some more ground on the Memory side. I use SASM to write my NASM code and the ld-linker, not the default gcc.

The assembly options are:
nasm -g -f elf32 $SOURCE$ -l $LSTOUTPUT$ -o $PROGRAM.OBJ$

And the linking options:
ld -m elf_i386 -s -o $PROGRAM$ $PROGRAM.OBJ$

Now, when I my programs in SASM, the Registers show up right, but the Memory Tab is blank and doesnt show any memory on runtime.
I didnt find any solution to it and a quick try on windows showed that it didnt work there too... Did I forget or overlook something? I would also really appreciate any suggestions for how to debug executables on linux where I can see the memory and instructions with break points and so on.

Thanks a lot! =)
Screenshot of my SASM: http://imgur.com/vjH11fb
« Last Edit: March 03, 2017, 11:08:47 PM by 0xDEADBEEF »

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2359
  • Country: us
Re: Memory debugger in SASM not working? (NASM on Linux without gcc)
« Reply #1 on: March 03, 2017, 11:32:09 PM »
I am not familiar with SASM, so I don't know if this has anything to do with your problem. You tell Nasm "-g" which adds debugging info (STABS is default, -F dwarf might be better). But then you tell ld "-s", which strips debugging info from the executable. It may not help to leave off the "-s", but it doesn't make much sense to ask Nasm for debugging info and then ask ld to remove it.

The "right" way to debug on Linux is to learn to use GDB. I have not done so, and consider GDB "unfriendly", so I can't help you much.

Best,
Frank

P.S. This is the debugger I use:
http://home.myfairpoint.net/fbkotler/debug-0.0.21.tgz

P.P.S. this is another alternative to GDB:
https://sourceforge.net/p/asmbug/wiki/Home/

I stress that learning to use GDB is the way to do it!

« Last Edit: March 03, 2017, 11:46:03 PM by Frank Kotler »

Offline 0xDEADBEEF

  • Jr. Member
  • *
  • Posts: 7
Re: Memory debugger in SASM not working? (NASM on Linux without gcc)
« Reply #2 on: March 04, 2017, 08:34:14 PM »
Thanks a lot, GDB and memory dumping was exactly what I was looking for! Its a really powerful tool!

Have a great day! :)