Hi,
I use gpc 20050331 build with gcc 3.4.3 on SUN Solaris2.6. I have gdb 5.3 installed, but it does not work very well with gpc: - The current source line is wrong most of the time - 'Next' do strange steps backward and forward - I cannot see strings contents (it says incomplete type) - Arrays of characters are displayed as binary (0's and 1's) - Some randomized gdb coredumps - Program does not stop where I put the breakpoints, but some lines before or after
I use DDD on top of gdb, but I have exactly the same problems when I use gdb alone. Since I am presently converting a lot of code from SUN Pascal to gpc, the debugger is somewhat essential...
So, is there a 'recommended' version of gdb to use with gpc 20050331? Also, are there some 'recommended' gdb settings for gpc?
Thanks
Pascal Viandier
pascal@accovia.com
Pascal Viandier wrote:
I use gpc 20050331 build with gcc 3.4.3 on SUN Solaris2.6. I have gdb 5.3 installed, but it does not work very well with gpc:
- The current source line is wrong most of the time
- 'Next' do strange steps backward and forward
- Program does not stop where I put the breakpoints, but some lines
before or after
Same problems on powerpc-apple-darwin.
Regards,
Adriaan van Os
Pascal Viandier wrote:
I use gpc 20050331 build with gcc 3.4.3 on SUN Solaris2.6. I have gdb 5.3 installed, but it does not work very well with gpc:
- The current source line is wrong most of the time
- 'Next' do strange steps backward and forward
- I cannot see strings contents (it says incomplete type)
- Arrays of characters are displayed as binary (0's and 1's)
- Some randomized gdb coredumps
- Program does not stop where I put the breakpoints, but some lines before
or after
Yes, these are known problems of GPC -- and GDB (whatever GPC outputs, GDB shouldn't crash, this one at least is a GDB bug).
1, 2, 6 are related, and I hope I can fix them when I get to it. 3 seems more difficult. Not sure about 4 ATM.
Frank
Pascal Viandier wrote:
I use gpc 20050331 build with gcc 3.4.3 on SUN Solaris2.6. I have gdb 5.3 installed, but it does not work very well with gpc:
- The current source line is wrong most of the time
This is a known problem in current GPC.
- 'Next' do strange steps backward and forward
Unfortunately, this is normal. GPC is an optimizing compiler and in particular instructions are usually executed in different order then the source. For example, given:
a := b; {line 1} c := d; {line 2}
the typical order is to first compute (fetch from memory) b and d and then to perform assignments. So you something like:
line 1 line 2 line 1 line 2
With correct line numbers and a little practice it actually makes sense. For debugging use -O0 to disable optimization, but even at -O0 some optimization still takes place.
- I cannot see strings contents (it says incomplete type)
- Arrays of characters are displayed as binary (0's and 1's)
- Some randomized gdb coredumps
- Program does not stop where I put the breakpoints, but some lines before
or after
It is probably first problem: wrong line number info.
I use DDD on top of gdb, but I have exactly the same problems when I use gdb alone. Since I am presently converting a lot of code from SUN Pascal to gpc, the debugger is somewhat essential...
So, is there a 'recommended' version of gdb to use with gpc 20050331? Also, are there some 'recommended' gdb settings for gpc?
Hard to make a recommendation. I use gdb-6.3 with a patch to fix some DWARF problems. The patch fixes most crashes (but the crashes were DWARF-specific) for me. Since Solaris-2.6 uses stabs your problems are probably quite different.