LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-26-2016, 07:36 AM   #1
micflunu
Member
 
Registered: Oct 2012
Posts: 73

Rep: Reputation: Disabled
Segmentation fault (core dumped)


I have this assembly file

.text
.globl if_stmt
.func if_stmt
if_stmt:
cmpl $1,%eax
je then
movl $2,%ebx
.endfunc
.globl then
.func then
then:
movl $3,%ebx
.endfunc
.globl _start #make start symbol visible
_start:
movl $1,%eax
call if_stmt

which i have the intention of that it will do copmarison
i compiled, linked and run it like the following

as -o if.o if.S
ld -o if if.o
./if
could any one tell me what the problem is???
 
Old 07-26-2016, 07:39 AM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
It is an incomplete program. No return - and it looks like it should do a stack overflow. The end of the function has no return... The start of the program has no terminination - it just falls into uninitialized memory...
 
Old 07-26-2016, 08:10 AM   #3
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,122

Rep: Reputation: 2270Reputation: 2270Reputation: 2270Reputation: 2270Reputation: 2270Reputation: 2270Reputation: 2270Reputation: 2270Reputation: 2270Reputation: 2270Reputation: 2270
you may try to use gdb to debug it...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
getting segmentation fault(core dumped) in ns-2 jaiswal.raaj Linux - Wireless Networking 2 12-26-2014 11:06 PM
Segmentation fault (core dumped) mohammad taqy bayat Linux - Newbie 3 08-25-2014 03:10 AM
Segmentation fault (core dumped) mayankladoia Programming 4 07-17-2010 03:11 AM
Segmentation fault (core dumped) nasim751 Programming 1 01-27-2008 10:18 PM
Segmentation fault (core dumped) hasanaydin Linux - General 0 03-27-2002 08:47 AM


All times are GMT -5. The time now is 10:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration