Author Topic: GDB "No such file or directory" on NASM file that exists  (Read 16167 times)

Offline paml27

  • Jr. Member
  • *
  • Posts: 37
GDB "No such file or directory" on NASM file that exists
« on: October 25, 2021, 11:14:58 PM »
I created this simple NASM program for Ubuntu 18.04 and compiled it to an exe as shown below.  When I run with gdb I get "No such file or directory" even though the file exists in the current directory

   ; Header Section
   [BITS 64]

   [default rel]

   global _start
   global NLTK_Gutenberg_fn
   extern Lib_Math
     
   section .data align=64
     
   section .rodata align=64
   module_name: db 'nltk',0x00

   ; _________

   section .text

   ; __________
   ; Main Entry
     
   _start:

   push rdi
   push rbp
   push rbx

   lea rdi,[module_name]
   call [rel Lib_Math wrt ..got]

   NLTK_Gutenberg_fn:
   mov rax,0
   mov rbx,0

   pop rbx
   pop rbp
   pop rdi
   ret

Compile and link:

   cd /opt/P01_SH/NLTK_Gutenberg/C_Replica

   sudo nasm -f elf64 -g -F dwarf NLTK_Gutenberg-exec.asm

   sudo ld NLTK_Gutenberg-exec.o /opt/P01_SH/NLTK_Gutenberg/C_Replica/Python_Math.o  -lpython3.8 -ldl -lrt -lpthread -L/usr/lib/python3.8/config-3.8-x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu/ -o NLTK_Gutenberg-exec.exe

   cd /opt/P01_SH/NLTK_Gutenberg/C_Replica
   gdb NLTK_Gutenberg-exec.exe

I usually create shared objects in NASM and I never have any problems, but with this .exe I am getting the "not found" error and I can't see why. 

Thanks. 


Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: GDB "No such file or directory" on NASM file that exists
« Reply #1 on: October 26, 2021, 12:07:56 AM »
"   gdb ./NLTK_Gutenberg-exec.exe " ?

Current directory not on your path?

Best,
Frank


Offline paml27

  • Jr. Member
  • *
  • Posts: 37
Re: GDB "No such file or directory" on NASM file that exists
« Reply #2 on: October 30, 2021, 11:13:32 PM »
Hi Frank, and thanks for the reply.  Sorry for the delay.  The problem was the path, and now it's okay. 

Offline Elvarushing

  • New Member
  • Posts: 1
Re: GDB "No such file or directory" on NASM file that exists
« Reply #3 on: December 28, 2022, 10:16:23 AM »
Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb73c4700 (LWP 7936)] IA__g_list_length (list=0x6e6920) at glist.c:767 767 glist.c: No such file or directory. in glist.c What is it? HP Instant Ink Login
« Last Edit: December 29, 2022, 04:32:18 AM by Elvarushing »

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: GDB "No such file or directory" on NASM file that exists
« Reply #4 on: December 28, 2022, 06:57:08 PM »
 Hi  Elvarushing,

Dunno. Is this Nasm  issue?

Best,
 Frank