🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #142

ptype command output

#142
From: Stephane Tsacas
Date: Thu, 30 Jul 1992 01:48
130 lines
3810 bytes
Hello,

I'm using gdb 4.5 compiled for a sparc (sunos 4.1.1).

With the following program :

#include <sys/types.h>
#include <sys/time.h>
#include <sys/proc.h>


struct proc p;

struct _struct1
{
  struct _struct1 *pstruct1;
  int rest;
};

struct _struct1 struct1;

main() {; }

(gdb) ptype struct _struct1
type = struct _struct1 {
    struct _struct1 *pstruct1;
    int rest;
}

;;; OK

But now, if I do `ptype struct proc', each component of struct proc
which is a `struct proc *' is expanded :

(gdb) ptype struct proc
type = struct proc {
    struct {
        struct <unknown> p_link;
        struct <unknown> p_rlink;
        struct <unknown> p_nxt;
        struct <unknown> *p_prev;
        struct as *p_as;
        struct seguser *p_segu;
        caddr_t p_stack;
        struct user *p_uarea;
        char p_usrpri;
        char p_pri;
        char p_cpu;
        char p_stat;
        char p_time;
        char p_nice;
        char p_slptime;
        char p_cursig;
        int p_sig;
        int p_sigmask;
        int p_sigignore;
        int p_sigcatch;
        int p_flag;
        unsigned short p_uid;
        unsigned short p_suid;
        unsigned short p_sgid;
        short p_pgrp;
        short p_pid;
        short p_ppid;
        unsigned short p_xstat;
        short p_cpticks;
        struct ucred *p_cred;
        struct rusage *p_ru;
        int p_tsize;
        int p_dsize;
        int p_ssize;
        int p_rssize;
        int p_maxrss;
        int p_swrss;
        caddr_t p_wchan;
        int p_pctcpu;
        struct <unknown> p_pptr;
        struct <unknown> p_cptr;
        struct <unknown> p_osptr;
        struct <unknown> p_ysptr;
        struct <unknown> p_tptr;
        struct itimerval p_realtimer;
        struct sess *p_sessp;
        struct <unknown> p_pglnk;
        short p_idhash;
        short p_swlocks;
        struct aiodone *p_aio_forw;
        struct aiodone *p_aio_back;
        int p_aio_count;
        int p_threadcnt;
    } *p_link;
    struct {
        struct <unknown> p_link;
        struct <unknown> p_rlink;
... for each struct proc * ...

I don't understand why the output differs.

Also, `info variables' expand p but not struct1, why ?


When I type `gdb bar.o' then `info variables' gdb crashes if bar.o
does not countain a main() fonction.  If this can help :
(top-gdb) r /tmp/bar.o
Starting program: /mnt/GNU/gdb-4.5/gdb/gdb /tmp/bar.o
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.5, Copyright 1992 Free Software Foundation, Inc...
Setting up the environment for debugging gdb.

Program received signal 11, Segmentation fault
During symbol reading, bad block start address patched.
0x28000 in lookup_symbol (name=0xf7fff928 "fatal", block=0x0, 
    namespace=VAR_NAMESPACE, is_a_field_of_this=0x0, symtab=0xf7fff954)
    at symtab.c:472
472               ALL_MSYMBOLS (objfile, msymbol)
(top-gdb)  p objfile->msymbols
$3 = (struct minimal_symbol *) 0x0
(top-gdb) 


  ,
Stephane


Stephane Tsacas			UUCP: slt@isoft.fr
1/3 av. Brancion, bat B		slt%isoftfr@uunet.UU.NET
75015 Paris			Phone: (33-1) 48 28 4994 / (33-1) 64 46 1748
France				<<PUSHJ P, POPJ P, recursively>>
Technical Details
Message-ID: <9207292148.AA07756@is22.isoft.fr>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!is22.ISoft.FR!slt

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!is22.ISoft.FR!slt
From: slt@is22.ISoft.FR (Stephane Tsacas)
Subject: ptype command output
Message-ID: <9207292148.AA07756@is22.isoft.fr>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 30 Jul 1992 01:48:46 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 131