PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

NOTE: Can't find main function compiled -g

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Debugging and Profiling
View previous topic :: View next topic  
Author Message
jonesds



Joined: 10 Mar 2006
Posts: 3

PostPosted: Fri Aug 04, 2006 6:08 am    Post subject: NOTE: Can't find main function compiled -g Reply with quote

Hi there, I am trying to debug some C code and am coming up with the following error when I run pgbdg:

NOTE: Can't find main function compiled -g

However, there is a main function and the code starts to run (and eventually falls over, hence the need to debug). The code compiles with a couple of warnings (Function XXX has non-ptototype declaration in scope) and, as I said, starts to run, thereby running the main function before falling over later on. What do I need to do to be able to debug this code and find out where it's really going wrong?

Any help you can offer would be greatly appreciated.
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6142
Location: The Portland Group Inc.

PostPosted: Fri Aug 04, 2006 9:03 am    Post subject: Reply with quote

Hi jonesds,

Try re-compiling your code with "-g" and then rerun using PGDBG. "-g" inserts symbols in the code which debugger can use to associate your source with the assembly code and give you more information as to where you are in the code and what is happening. While you can use the debugger without compiling "-g", it can be difficult to debug unless you understand assembly code.

For information about using PGDBG, please refer to the PGI Tools Guide (found HERE).

- Mat
Back to top
View user's profile
jonesds



Joined: 10 Mar 2006
Posts: 3

PostPosted: Mon Aug 07, 2006 1:20 am    Post subject: Reply with quote

Hi Mat,

Thanks for your suggestion but I have already tried compiling with -g in order to debug the code; this is why the error is so puzzling!

I'd be very grateful for any further thoughts you may have on this.
Back to top
View user's profile
jonesds



Joined: 10 Mar 2006
Posts: 3

PostPosted: Mon Aug 07, 2006 7:37 am    Post subject: Reply with quote

Fixed it!

My apologies for wasting your time, I've just realised that I had -s in the link command. Thereby stripping any markers out of the code and completely negating the -g used on compilation.

What an idiot.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Debugging and Profiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group