Re: weird -current gdb/gcc(?) problem

2001-11-01 Thread Maksim Yevmenkin

Joerg,

  first of all i want to apoligize. i sent the wrong output. yes, it
  does the right thing if you use -g switch, however it does not
  work for me if i use -ggdb switch.
 
 Indeed, the output generated with -ggdb looks weird.  But then, it
 never occurred to me to use -ggdb at all.  Why would one want to do
 this?

i have one program that works on linux and solaris and i need
to run it on freebsd. the -ggdb switch is in program's Makefile. 
i can compile it just fine, but when i run it - it core dumps. 
the core dump is more weird that gdb frame output. gdb shows 
endless recursive call to 

inet_addr()
__inet_aton()
inet_addr()
__inet_aton()

etc. as soon as there is no more stack - program coredumps :(
so i'm trying to fix it.
 
thanks,
max

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: weird -current gdb/gcc(?) problem

2001-11-01 Thread Andrew R. Reiter

On Thu, 1 Nov 2001, Maksim Yevmenkin wrote:
:inet_addr()
:__inet_aton()
:inet_addr()
:__inet_aton()
:

I've had similar issues.  I just sent in a pr yesterday where the
recursive call was to sigprocmask() -- this happened when I managed to
core sysinstall and when I managed to core cvs remotely.

ugh.

Andrew

*-.
| Andrew R. Reiter 
| [EMAIL PROTECTED]
| It requires a very unusual mind
|   to undertake the analysis of the obvious -- A.N. Whitehead


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



weird -current gdb/gcc(?) problem

2001-10-31 Thread Maksim Yevmenkin

Hackers,

first of all i want to apologize for posting this in -current.
this should probably go into -questions. 

i have some weird problem. i have cvsup'ed and installed -current
yesterday. i have attached script(1) output. quick search came up
with nothing.

did i miss anything?

thanks
max

Script started on Wed Oct 31 09:49:56 2001
beetle% uname -a
FreeBSD beetle 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Tue Oct 30 13:23:19 PST 2001 
root@beetle:/usr/obj/usr/src/sys/BEETLE  i386
beetle% 
beetle% 
beetle% cat c2.sh
#!/bin/sh -x
gcc -v
ld -v
ar -V
rm a.out libtest.a lib.o
cat lib.c
cat prog1.c
gcc -Wall -g -c -o lib.o lib.c
ar cr libtest.a lib.o
gcc -Wall -g prog1.c -L. -ltest
./a.out
gdb a.out

beetle% 
beetle% 
beetle% ./c2.sh
+ gcc -v
Using builtin specs.
gcc version 2.95.3 20010315 (release)
+ ld -v
GNU ld version 2.11.2 20010719 [FreeBSD] (with BFD 2.11.2 20010719 [FreeBSD])
+ ar -V
GNU ar 2.11.2 20010719 [FreeBSD]
Copyright 1997, 98, 99, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
+ rm a.out libtest.a lib.o
rm: libtest.a: No such file or directory
rm: lib.o: No such file or directory
+ cat lib.c
#include stdio.h

int
foo(int i, short s, char c, char *str)
{
printf(%d, %d, %d, %s\n, i, s, c, str);
return (0);
}
+ cat prog1.c
#include stdio.h

int foo (int, short, char, char *);

int
main(void)
{
return (foo(1, 2, '3', test));
}

int
foo(int i, short s, char c, char *str)
{
printf(%d, %d, %d, %s\n, i, s, c, str);
return (0);
}

+ gcc -Wall -g -c -o lib.o lib.c
+ ar cr libtest.a lib.o
+ gcc -Wall -g prog1.c -L. -ltest
+ ./a.out
1, 2, 51, test
+ gdb a.out
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type show copying to see the conditions.
There is absolutely no warranty for GDB.  Type show warranty for details.
This GDB was configured as i386-unknown-freebsd...
(gdb) b main
Breakpoint 1 at 0x80484c6: file prog1.c, line 8.
(gdb) run
Starting program: /usr/home/max/test/a.out 

Breakpoint 1, main () at prog1.c:8
8   return (foo(1, 2, '3', test));
(gdb) s
foo (i=1, s=10244, c=-54 'Ê', str=0x804855b test) at prog1.c:13
13  {
(gdb) q
The program is running.  Exit anyway? (y or n) y
beetle% 
beetle% 
beetle% 
beetle% cat c1.sh
#!/bin/sh -x
gcc -v
ld -v
rm a.out
cat prog1.c
gcc -Wall -g prog1.c
./a.out
gdb a.out
beetle% 
beetle% 
beetle% ./c1.sh
+ gcc -v
Using builtin specs.
gcc version 2.95.3 20010315 (release)
+ ld -v
GNU ld version 2.11.2 20010719 [FreeBSD] (with BFD 2.11.2 20010719 [FreeBSD])
+ rm a.out
+ cat prog1.c
#include stdio.h

int foo (int, short, char, char *);

int
main(void)
{
return (foo(1, 2, '3', test));
}

int
foo(int i, short s, char c, char *str)
{
printf(%d, %d, %d, %s\n, i, s, c, str);
return (0);
}

+ gcc -Wall -g prog1.c
+ ./a.out
1, 2, 51, test
+ gdb a.out
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type show copying to see the conditions.
There is absolutely no warranty for GDB.  Type show warranty for details.
This GDB was configured as i386-unknown-freebsd...
(gdb) b main
Breakpoint 1 at 0x80484c6: file prog1.c, line 8.
(gdb) run
Starting program: /usr/home/max/test/a.out 

Breakpoint 1, main () at prog1.c:8
8   return (foo(1, 2, '3', test));
(gdb) s
foo (i=1, s=10244, c=-54 'Ê', str=0x804855b test) at prog1.c:13
13  {
(gdb) q
The program is running.  Exit anyway? (y or n) y
beetle% exit

Script done on Wed Oct 31 09:50:49 2001



[Fwd: weird -current gdb/gcc(?) problem]

2001-10-31 Thread Maksim Yevmenkin

 


Alexander N. Kabaev wrote:
 
 What is the problem exactly? It is hard to guess that from the
 information you posted.
 
  foo (i=1, s=10244, c=-54 'J', str=0x804855b test) at prog1.c:13
 Is that what bothers you? It happens because
 your code is compiled with no optimization, and that causes gcc to
 allocate temporary backing storage for all parameters in the function
 foo. When you type an 's' command to step into the foo function from
 main, gcc stops immediately after function stack frame has been
 initialized but before parameters have been copied into their respective
 temporary locations.

yes, but i posted wrong output :( try to do the same but use
-ggdb instead of -g switch. even if you step info function
some funny things happen. you can try to do both -O2 -ggdb vs.
-ggdb only.

thanks,
max




Re: weird -current gdb/gcc(?) problem

2001-10-31 Thread Joerg Wunsch

Maksim Yevmenkin [EMAIL PROTECTED] wrote:

 i have some weird problem.

Well, it would have been nice if you had told what you deemed to
be the problem. ;-)  I can't find any problem at all...

 Breakpoint 1, main () at prog1.c:8
 8 return (foo(1, 2, '3', test));
 (gdb) s
 foo (i=1, s=10244, c=-54 'Ê', str=0x804855b test) at prog1.c:13

If you mean it should look like:

foo (i=1, s=2, c=51 '3', str=0x804855b test) at prog1.c:13

here, erm, no.  Your breakpoint simply hit before the function stack
frame initialization was complete, so gdb displays the wrong values at
that point.  Just type a single `s', followed by a `where', and you'll
see it will eventually get the argument list right then.

-- 
cheers, Jorg   .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: weird -current gdb/gcc(?) problem

2001-10-31 Thread Maksim Yevmenkin

Joerg,

  i have some weird problem.
 
 Well, it would have been nice if you had told what you deemed to
 be the problem. ;-)  I can't find any problem at all...
 
  Breakpoint 1, main () at prog1.c:8
  8 return (foo(1, 2, '3', test));
  (gdb) s
  foo (i=1, s=10244, c=-54 'Ê', str=0x804855b test) at prog1.c:13
 
 If you mean it should look like:
 
 foo (i=1, s=2, c=51 '3', str=0x804855b test) at prog1.c:13
 
 here, erm, no.  Your breakpoint simply hit before the function stack
 frame initialization was complete, so gdb displays the wrong values at
 that point.  Just type a single `s', followed by a `where', and you'll
 see it will eventually get the argument list right then.

first of all i want to apoligize. i sent the wrong output. yes, it
does the right thing if you use -g switch, however it does not
work for me if i use -ggdb switch.

thanks,
max

Script started on Wed Oct 31 13:46:09 2001
beetle% uname -a
FreeBSD beetle 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Tue Oct 30 13:23:19 PST 2001 
root@beetle:/usr/obj/usr/src/sys/BEETLE  i386
beetle% cat c1.sh 
#!/bin/sh -x
gcc -v
ld -v
rm a.out
cat prog1.c
gcc -Wall -ggdb prog1.c
./a.out
gdb a.out
beetle% ./c1.sh
+ gcc -v
Using builtin specs.
gcc version 2.95.3 20010315 (release)
+ ld -v
GNU ld version 2.11.2 20010719 [FreeBSD] (with BFD 2.11.2 20010719 [FreeBSD])
+ rm a.out
+ cat prog1.c
#include stdio.h

int foo (int, short, char, char *);

int
main(void)
{
return (foo(1, 2, '3', test));
}

int
foo(int i, short s, char c, char *str)
{
printf(%d, %d, %d, %s\n, i, s, c, str);
return (0);
}

+ gcc -Wall -ggdb prog1.c
+ ./a.out
1, 2, 51, test
+ gdb a.out
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type show copying to see the conditions.
There is absolutely no warranty for GDB.  Type show warranty for details.
This GDB was configured as i386-unknown-freebsd...
(gdb) b main
Breakpoint 1 at 0x80484c6: file prog1.c, line 8.
(gdb) run
Starting program: /usr/home/max/test/a.out 

Breakpoint 1, main () at prog1.c:8
8   return (foo(1, 2, '3', test));
(gdb) s
foo (i=671494208, s=10246, c=16 '\020', str=0x2804ca2b \203~T) at prog1.c:13
13  {
(gdb) s
14  printf(%d, %d, %d, %s\n, i, s, c, str);
(gdb) where
#0  foo (i=671494208, s=10246, c=16 '\020', 
str=0x2332b Error reading address 0x2332b: Bad address) at prog1.c:14
#1  0x80484d6 in main () at prog1.c:8
(gdb) p i
$1 = 671494208
(gdb) p s 
$2 = 10246
(gdb) p c
$3 = 16 '\020'
(gdb) p str
$4 = 0x2332b Error reading address 0x2332b: Bad address
(gdb) q
The program is running.  Exit anyway? (y or n) y
beetle% exit

Script done on Wed Oct 31 13:46:46 2001



Re: weird -current gdb/gcc(?) problem

2001-10-31 Thread Joerg Wunsch

As Maksim Yevmenkin wrote:

 first of all i want to apoligize. i sent the wrong output. yes, it
 does the right thing if you use -g switch, however it does not
 work for me if i use -ggdb switch.

Indeed, the output generated with -ggdb looks weird.  But then, it
never occurred to me to use -ggdb at all.  Why would one want to do
this?

If i get around, i'll try it on another OS and/or architecture.
-- 
cheers, Jorg   .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message