SGI: Development

gcc 4.7 and gdb 6.3 problem - Page 1

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
did you set a breakpoint? if yes how?

_________________
r-a-c.de
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
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.
alternatively you could just use "disas" on main and set an explicit breakpoint

_________________
r-a-c.de
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
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
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
Try a newer GDB, there have been some changes to the debugging format in gcc 4.something.
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
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.

_________________
waiting for flight 1203 ...
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
Presumably you don't have the cvd debugger that comes with Prodev Workshop?

_________________
Project:
Movin' on up, toooo the east side
Plan:
World domination! Or something...
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:
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:
Movin' on up, toooo the east side
Plan:
World domination! Or something...
Hi,

Actually I have a dbx version 7.3.1 (got it wrong before sorry) and it is listed in the software manager as
dbx software so I am not sure if it is from the ProDev or not.

I am working through some of the gdb errors so far I have

regex.c - ATTRIBUTE_ALIGNED_ALIGNOF not defined
sim-memopt.c missing xmalloc declaration
mdmx.c - empty structure initializations
igen.c - unsigned64 not defined (actually from misc.h)

still working through things but given some of the warnings about alignment I would be surprised it this works correctly.

Cheers
dbx is separate but should work correctly anyway.

_________________
r-a-c.de
Kind of works but at start up get CPU not recgnised assuming not R8000.

Also get some memory errors and can have a tedency to not stop at break points.

Just saying.

Cheers
If I may ask, what software is this? Must be pretty old if it hasn't been updated since the R8000 was state of the art... :shock:

_________________
Project:
Movin' on up, toooo the east side
Plan:
World domination! Or something...
dbx is the official irix debugger and works fine with up to the r16k

_________________
r-a-c.de