Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* gdb can't find command line args
@ 1997-07-31 21:06 Christopher J. Grayce
  0 siblings, 0 replies; 2+ messages in thread
From: Christopher J. Grayce @ 1997-07-31 21:06 UTC (permalink / raw)


Dear Folks,

   I am bedeviled with gdb problems.  Can anyone hint at what might be
going on here?  I have a PC164 Alpha clone on which I installed RH 4.1
without significant incident, and then made a number of package
upgrades to from the RH 4.2 distribution using the rpm utility and
downloads from ftp.redhat.com. In particular, I got the latest gdb,
glibc, and binutils.  I believe I'm already running the latest gcc
for which there is an rpm.
   The kernel is 2.0.30 which built without error from the 2.0.30
source from ftp.funet.fi and the 2.0.30-0.1 patches from gatekeeper.
MILO is from the 2.0.30 source at gatekeeper, and also built without
error.
   Below I append a detailed description of one of the problems.  I
would be glad of any help.  Essentially my only use for this computer
is reasonably complex scientific C programming -- I don't give a damn
about web serving or having a cool window manager.  But not having a
reliable C debugger (or is it the compiler?) is an absolute curse.

Christopher Grayce
UCI Dept of Chemistry
--------------------------------------------------------------------------
Here is the output from the appropriate rpm -q commands:
--------------------------------------------------------------------------
(wasatch)home/cgrayce% uname -a
Linux wasatch.ps.uci.edu 2.0.30 #1 Thu Jul 31 04:26:50 PDT 1997 alpha
(wasatch)home/cgrayce% rpm -q gdb
gdb-4.16-6
(wasatch)home/cgrayce% rpm -q glibc
glibc-0.961212-5
(wasatch)home/cgrayce% rpm -q gcc
gcc-2.7.2.1-2
--------------------------------------------------------------------------
The biggest present problem gdb gives me is that it does not correctly
print out the values of variables (which, of course, makes it useless).
Here is a short program that illustrates this:
--------------------------------------------------------------------------
/* silly.c */
#include <stdlib.h>
#include <stdio.h>

typedef struct {
  double x ;
  double y ;
  double z ;
} xyz_triple ;

int main(int argc, char *argv[]) {

  xyz_triple fluid[2000] ;
  printf("argc = %d, argv = %p\n",argc,argv) ;
  return(0) ;
}
/* end */
--------------------------------------------------------------------------
And here is the result from running gcc and gdb on this code:
--------------------------------------------------------------------------
(wasatch)home/cgrayce% cc -g silly.c
(wasatch)home/cgrayce% gdb a.out
GDB is free software and you are welcome to 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.
GDB 4.16 (alpha-unknown-linux), Copyright 1996 Free Software Foundation, Inc...
(gdb) break 14
Breakpoint 1 at 0x1200008e8: file silly.c, line 14.
(gdb) run
Starting program: /home/cgrayce/a.out

Breakpoint 1, main () at silly.c:14
15        printf("argc = %d, argv = %p\n",argc,argv) ;
(gdb) print argc
$1 = 0                           <------ what??
(gdb) print argv
$2 = (char **) 0x0               <------ excuse me?!
(gdb) cont
Continuing.
argc = 1, argv = 0x11ffffb88

Program exited normally.
(gdb)

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: gdb can't find command line args
       [not found] <Pine.LNX.3.95.970801103025.11208A-100000@nexus.carleton.ca>
@ 1997-08-02  5:24 ` Christopher J. Grayce
  0 siblings, 0 replies; 2+ messages in thread
From: Christopher J. Grayce @ 1997-08-02  5:24 UTC (permalink / raw)


On Fri, 1 Aug 1997, Maciek Klimkowski wrote:

> 
> 
> On Thu, 31 Jul 1997, Christopher J. Grayce wrote:
> 
> > Breakpoint 1, main () at silly.c:14
> > 15        printf("argc = %d, argv = %p\n",argc,argv) ;
> > (gdb) print argc
> > $1 = 0                           <------ what??
> > (gdb) print argv
> > $2 = (char **) 0x0               <------ excuse me?!
> > (gdb) cont
> > Continuing.
> > argc = 1, argv = 0x11ffffb88
> 
> hrm i've run it on a solaris, with correct results.. Does the same happen
> for every other variable you are trying to inspect?
> 

Yes indeed.  *All* variables are looked for at the wrong addresses,
which I can tell by having the program print out their addresses 
and then asking gdb what it thinks they are.

Christopher Grayce

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-08-02  5:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-07-31 21:06 gdb can't find command line args Christopher J. Grayce
     [not found] <Pine.LNX.3.95.970801103025.11208A-100000@nexus.carleton.ca>
1997-08-02  5:24 ` Christopher J. Grayce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox