Author Topic: nasm and insight on Ubuntu 64 bit  (Read 13106 times)

Offline dalfonso01

  • Jr. Member
  • *
  • Posts: 44
nasm and insight on Ubuntu 64 bit
« on: April 22, 2016, 10:58:38 PM »
Hi,
I made a successful build of insight from the https://github.com/monnerat/insight.git git repository from Patrick Monnerat, on ubuntu 16.04 LTS released yesterday.
I was able to debug something built with the nasm on a 32 platform (and older ubuntu) following the well known Duntemann book. I am getting some issue getting working the examples rebuilt on the 64 bit VM.
Is there some tutorial on a right source-to-debug path in 64 bit systems?
Up to some year ago (so not much) all the focus seemed to be all on 32 bit, so there little about the production chain on 64 bit environments.

Thanks
Fabio D'Alfonso

Offline Bryant Keller

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 360
  • Country: us
    • About Bryant Keller
Re: nasm and insight on Ubuntu 64 bit
« Reply #1 on: April 23, 2016, 03:19:54 AM »
I've never read Duntemann's book and I don't even own a 64-bit Intel platform. Only 64-bit system I have is ARM based. That said, I'm probably not the best person to answer this question. However, my source of reference for most things 64-bit is Ray Toal's NASM Tutorial. If you're already familiar with 32-bit assembly, the tutorial is really easy to follow along with and in many cases I've actually answered questions on this forum by writing 32-bit version and just using that tutorial as a guide-line for converting. One thing I find many people forget when going between 32- and 64-bit NASM is changing the -f option from -f elf to -f elf64 or missing the -g option, could this be the reason for your problem? I have heard rumors that NASM's 64-bit versions had problems with debugging but I never really had a chance to check it out myself. A friend of mine mentioned that he reverted back to version 2.7 and GDB under 64-bit systems worked fine there. If all else fails, you might try building NASM 2.7 from source. Keep us updated about your progress.

About Bryant Keller
bkeller@about.me

Offline dalfonso01

  • Jr. Member
  • *
  • Posts: 44
Re: nasm and insight on Ubuntu 64 bit
« Reply #2 on: April 23, 2016, 07:18:36 AM »
Hi,
thanks. I already made that change to elf64.
makefile:
 eatsyscall: eatsyscall.o
     ld -o eatsyscall eatsyscall.o
 eatsyscall.o: eatsyscall.asm
     nasm -f elf64 -g -F dwarf eatsyscall.asm -l eatsyscall.lst

and got a working executable.

I will try to make something from scratch based on the tutorial (thanks for pointing at that).

It seems that there is little or nothing for 64 bit. Why this so big gap in the literature?

Thanks
Fabio D'Alfonso
« Last Edit: April 23, 2016, 10:14:50 AM by dalfonso01 »

Offline Bryant Keller

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 360
  • Country: us
    • About Bryant Keller
Re: nasm and insight on Ubuntu 64 bit
« Reply #3 on: April 23, 2016, 09:06:03 PM »
It seems that there is little or nothing for 64 bit. Why this so big gap in the literature?

I'm sure there are many reasons for this, but the primary one would probably be that since most people are taught assembly language programming in college, the books explaining assembly language are going to target them.. and colleges don't change subject matter very quickly. It takes time (and money) to change lesson plans, update/review/implement new student lab material, and print new books. So changing in this way is only done on the academic level when the old material is completely obsolete, and since the 64-bit systems support a 32-bit compatibility mode, that hasn't happened. Keep in mind, it wasn't long ago that we were all having this same conversation about 16- and 32-bit systems.

In the more specific case of Duntemann's book, he mentions on his site that it was his publisher's fault:

Quote from: Jeff Duntemann
Note that the book was written for the commonest PC hardware, based on Intel/AMD 32-bit CPUs. I had hoped to get some 64-bit coverage in there, but the publisher set a hard limit on the length of the book for cost reasons. I'm going to try and twist their arms to give me another 100 pages for the next edition, but in the meantime, it's a 32-bit book.


About Bryant Keller
bkeller@about.me