Hi Alan,
I can reproduce the problem on my system running bash so I don't think
it is related the the shell:
(gdb) b main
Breakpoint 1 at 0x8050ccc: file g.c, line 4.
(gdb) r
Starting program: /home/gvasick/a.out
Breakpoint 1, main (argc=260904, argv=0xfef90018) at g.c:4
4 {
I also notice that stepping one statement seems to resolve the problem:
(gdb) n
main (argc=1, argv=0x8047a88) at g.c:5
5 printf ("hello world!\n");
(gdb) p argc
$1 = 1
(gdb) p *argv
$2 = 0x8047b60 "/home/gvasick/a.out"
I get worse behavior with dbx:
(dbx) run
Running: a.out
(process id 3625)
stopped in main at line 4 in file "g.c"
4 {
(dbx) print argc
argc = -16795644
(dbx) print *argv
*argv = 0x3fb28 "<bad address 0x3fb28>"
(dbx) next
stopped in main at line 5 in file "g.c"
5 printf ("hello world!\n");
(dbx) print argc
argc = 134511124
(dbx) print *argv
*argv = 0x1 "<bad address 0x1>"
although the program itself correctly prinst out argc and argv:
1, /home/gvasick/a.out
George
On 10/1/2010 2:06 AM, Alan Burlison wrote:
On 01/10/2010 03:17, Saadia Fatima wrote:
Invalid argc value is passed to main, when I run the program with no
cmmand line arguments
main(argc = 134551360, argv=0x8047b2a) // from gdb
How to fix this??
Which shell are you using?
_______________________________________________
opensolaris-discuss mailing list
[email protected]