4 Replies - 11038 Views - Last Post: 08 April 2012 - 10:02 AM Rate Topic: -----

#1 jkl510  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 05-April 12

Seg Fault - During startup program exited with code 126.

Posted 08 April 2012 - 12:28 AM

Hey everyone,

Just starting using C++ and the gdb debugger for some coursework.

Basically, the gist of my problem is that I'm attempting to debug a Segmentation Fault in gdb.

However, I'm completely stuck as to how to get around this error msg:

$ gdb mainSort
(gdb) run
Starting program: /home/josh/Desktop/HW1/mainSort 

/bin/bash: /home/josh/Desktop/HW1/mainSort: Permission denied
/bin/bash: line 0: exec: /home/josh/Desktop/HW1/mainSort: cannot execute: Permission denied
During startup program exited with code 126.




I've been looking around for resources online...not much helpful. I've tried changing file permissions, but couldn't figure out what to do otherwise.

If it's at all relevant, I am using Ubuntu 11.04.

Is This A Good Question/Topic? 0
  • +

Replies To: Seg Fault - During startup program exited with code 126.

#2 no2pencil  Icon User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6635
  • View blog
  • Posts: 30,898
  • Joined: 10-May 07

Re: Seg Fault - During startup program exited with code 126.

Posted 08 April 2012 - 12:41 AM

Permission denied is really straight forward. Either your user does not have the required permission to run the program, the file isn't set to executable, or you didn't include the full path when you tried to start execution.
Was This Post Helpful? 0
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6246
  • View blog
  • Posts: 24,014
  • Joined: 23-August 08

Re: Seg Fault - During startup program exited with code 126.

Posted 08 April 2012 - 03:34 AM

Can you run the executable outside of the debugger?
Was This Post Helpful? 0
  • +
  • -

#4 r.stiltskin  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2032
  • View blog
  • Posts: 5,435
  • Joined: 27-December 05

Re: Seg Fault - During startup program exited with code 126.

Posted 08 April 2012 - 08:59 AM

What output do you get from this command:
ls -l /home/josh/Desktop/HW1/mainSort 

Was This Post Helpful? 0
  • +
  • -

#5 jkl510  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 05-April 12

Re: Seg Fault - During startup program exited with code 126.

Posted 08 April 2012 - 10:02 AM

Figured it out!

After much searching, I found and used the command:

$chmod +x filename



This enabled it to run. Thanks for all the responses.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1