Nekochan Net

Official Chat Channel: #nekochan // irc.nekochan.net
It is currently Sat Oct 25, 2014 3:07 pm

All times are UTC - 8 hours [ DST ]


Forum rules


Any posts concerning pirated software or offering to buy/sell/trade commercial software are subject to removal.



Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2  Next
Author Message
Unread postPosted: Sat May 04, 2013 1:47 am 
Offline

Joined: Wed Aug 02, 2006 3:06 am
Posts: 268
Hi,

I have a piece of code that I was trying to compile and debug with gcc 4.7 and gdb 6.3.

Maybe these two versions are not compatible?

The problem is that when debugging code compiled with the -g option the debugger does not stop in main.
Rather it stops at a line of code that is about 1/3 of the way through the source file.

Anyone else seen this?

Cheers


Top
 Profile  
 
Unread postPosted: Sat May 04, 2013 2:55 am 
Offline
User avatar

Joined: Mon Apr 14, 2003 4:34 am
Posts: 5230
did you set a breakpoint? if yes how?

_________________
r-a-c.de


Top
 Profile  
 
Unread postPosted: Sat May 04, 2013 3:20 am 
Offline

Joined: Wed Aug 02, 2006 3:06 am
Posts: 268
yes I did

under gdb I used

break main

but also I ran it as

gdb -dbx

and used stop in main

both incorrectly stopped at the same line in the code.

Cheers


Top
 Profile  
 
Unread postPosted: Sun May 05, 2013 8:56 am 
Offline
User avatar

Joined: Mon Jul 21, 2003 6:19 am
Posts: 754
If you compile with any kind of optimizations, there may be no 1:1 mapping between the lines of source code and the program code. Sometimes, if you single-step through the program, the execution will jump all over the place. Try recompiling with -O0.


Top
 Profile  
 
Unread postPosted: Sun May 05, 2013 1:07 pm 
Offline
User avatar

Joined: Mon Apr 14, 2003 4:34 am
Posts: 5230
alternatively you could just use "disas" on main and set an explicit breakpoint

_________________
r-a-c.de


Top
 Profile  
 
Unread postPosted: Mon May 06, 2013 2:21 am 
Offline

Joined: Wed Aug 02, 2006 3:06 am
Posts: 268
Compilation line is

gcc -g source.c


Also output the result of preprocessing and looking at the result of that it appears that the preprocess is keeping line numbers ok.

Looking at the output from gcc -S and comparing the code from it appears that

disas main show the correct code.

However

info line main

shows

Line 102 of "lg.c" starts at address 0x100026f8 <test_interior+80> amnd ends at <main+1088>

Clearly when I use

break main
run

I would hope that it would indicate that I am at start address 0x???? <main+offset>

Still scratching my head at this one.

Cheers


Top
 Profile  
 
Unread postPosted: Mon May 06, 2013 2:30 am 
Offline

Joined: Wed Aug 02, 2006 3:06 am
Posts: 268
one other thing I wanted to add. If I compile it with my mipspro 7.4.4m the gdb 6.3 gets the line numbers correct but I get some other issues which I was hoping that using a gcc/gdb combo would fix and not throw this problem up.

Cheers


Top
 Profile  
 
Unread postPosted: Mon May 06, 2013 4:27 am 
Offline
User avatar

Joined: Mon Apr 14, 2003 4:34 am
Posts: 5230
well gnu for everything but x86 is only the cheap alternative in most cases. having glitches like this is quite common

_________________
r-a-c.de


Top
 Profile  
 
Unread postPosted: Mon May 06, 2013 4:59 am 
Offline
Moderator
Moderator
User avatar

Joined: Tue Nov 25, 2003 1:09 pm
Posts: 799
Location: Europe
Try a newer GDB, there have been some changes to the debugging format in gcc 4.something.


Top
 Profile  
 
Unread postPosted: Mon May 06, 2013 2:56 pm 
Offline

Joined: Wed Aug 02, 2006 3:06 am
Posts: 268
I thought that it might come down to using a newer version of gdb.

Anyone know who did the neko 6.3 compile. Just want to find out if there any special instructions?

Cheers


Top
 Profile  
 
Unread postPosted: Mon May 06, 2013 6:36 pm 
Offline

Joined: Tue Feb 24, 2004 5:10 pm
Posts: 9702
competentcompton wrote:
Anyone know who did the neko 6.3 compile. Just want to find out if there any special instructions?

Usually that's all in the release notes ... /usr/nekoware/relnotes

If you wanted to upgrade you can take the original spec and idb files that you'll find in /usr/nekoware/dist and make a tardist .... it's not difficult, just a little tedious.

_________________
united forever in friendship and labour, our mighty republic will ever endure ...


Top
 Profile  
 
Unread postPosted: Thu May 09, 2013 3:59 am 
Offline

Joined: Wed Aug 02, 2006 3:06 am
Posts: 268
well the release notes setings certainly do not work for a compile of gdb 7.6

I'll have to look into this one some more. Already getting compiler errors.

Cheers


Top
 Profile  
 
Unread postPosted: Thu May 09, 2013 12:35 pm 
Offline
User avatar

Joined: Sun Mar 18, 2007 3:25 pm
Posts: 1898
Location: Minneapolis, Minnesota USA
Presumably you don't have the cvd debugger that comes with Prodev Workshop?

_________________
Project:
Temporarily lost at sea...
Plan:
World domination! Or something...


Top
 Profile  
 
Unread postPosted: Thu May 09, 2013 3:02 pm 
Offline

Joined: Wed Aug 02, 2006 3:06 am
Posts: 268
Sensitive topic

I have db which is version 7.1 (I think) and it was giving problems with debugging code from my 7.4.4m compiler.

I can't find it and may have lost the disk it is on (darn!)

I thought I would try using gdb 6.3 but it (pparently) has issues with mips C++ code.

Then I thought "sod it" I will try to use gcc 4.7 but presto it doesn't work either.

I have gone full round trip and am now left with compiling gdb myself and hoping that it works with gcc 4.7

:roll:


Top
 Profile  
 
Unread postPosted: Thu May 09, 2013 3:52 pm 
Offline
User avatar

Joined: Sun Mar 18, 2007 3:25 pm
Posts: 1898
Location: Minneapolis, Minnesota USA
Is that the version of cvd that comes with Prodev Workshop 2.9.1? Looks like they haven't updated the product information since MIPSPro 7.4 came out: http://techpubs.sgi.com/library/tpl/cgi-bin/summary.cgi?db=bks&docnumber=007-2582-006

_________________
Project:
Temporarily lost at sea...
Plan:
World domination! Or something...


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2  Next

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group