home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-01-23 | 37.1 KB | 1,413 lines |
- Newsgroups: alt.sources
- Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!newsserver.jvnc.net!princeton!csservices!tyrolia!mg
- From: mg@tyrolia (Michael Golan)
- Subject: Duel - a language for debugging C programs part 6/6
- Message-ID: <1993Jan22.034852.21328@csservices.Princeton.EDU>
- Sender: news@csservices.Princeton.EDU (USENET News System)
- Organization: Department of Computer Science, Princeton University
- Date: Fri, 22 Jan 1993 03:48:52 GMT
- Lines: 1402
-
- Submitted-by: mg@cs.princeton.edu
- Archive-name: duel/part06
-
- #!/bin/sh
- # This is part 06 of duel
- if touch 2>&1 | fgrep 'amc' > /dev/null
- then TOUCH=touch
- else TOUCH=true
- fi
- # ============= src/print.c ==============
- echo "x - extracting src/print.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > src/print.c &&
- X/* DUEL - A Very High Level Debugging Langauge. */
- X/* Public domain code */
- X/* Written by Michael Golan mg@cs.princeton.edu */
- X/*$Header: /tmp_mnt/n/fs/grad2/mg/duel/RCS/print.c,v 1.3 93/01/12 21:53:45 mg Exp $*/
- X
- X/* handle value/type printing */
- X
- X/*
- X * $Log: print.c,v $
- X * Revision 1.3 93/01/12 21:53:45 mg
- X * cleanup and set for release
- X *
- X * Revision 1.2 93/01/07 00:14:34 mg
- X * print union name
- X *
- X * Revision 1.1 93/01/03 07:31:55 mg
- X * Initial revision
- X *
- X */
- X
- X#include "duel.h"
- X
- X/* print type information (no new lines)
- X * parm 'expand' controls expansion level for structs & unions. normally 1.
- X */
- X
- XPROC duel_print_type(tctype *t,int expand)
- X{
- X int i ;
- X tctype *kid=t->u.kid ;
- X
- X switch(t->type_kind) {
- X case CTK_VOID: printf("void ") ; break ;
- X case CTK_CHAR: printf("char ") ; break ;
- X case CTK_UCHAR: printf("uchar ") ; break ;
- X case CTK_USHORT: printf("ushort ") ; break ;
- X case CTK_SHORT: printf("short ") ; break ;
- X case CTK_INT: printf("int ") ; break ;
- X case CTK_UINT: printf("uint ") ; break ;
- X case CTK_LONG: printf("long ") ; break ;
- X case CTK_ULONG: printf("ulong ") ; break ;
- X case CTK_FLOAT: printf("float ") ; break ;
- X case CTK_DOUBLE: printf("double ") ; break ;
- X case CTK_ENUM: printf("enum %s ",t->name); break ;
- X
- X case CTK_PTR:
- X if(ctype_kind_base(kid)) {
- X duel_print_type(kid,0);
- X printf("* ");
- X }
- X else {
- X printf("ptr to ");
- X duel_print_type(kid,expand-1) ;
- X }
- X break ;
- X case CTK_ARRAY: {
- X int n=t->size ;
- X if(kid->size>0) n/=kid->size ;
- X
- X if(ctype_kind_base(kid)) {
- X duel_print_type(kid,0);
- X printf("[%d] ",n);
- X }
- X else {
- X printf("array [%d] of ",n);
- X duel_print_type(kid,expand) ;
- X }
- X }
- X break ;
- X case CTK_FUNC: printf("func returning ");
- X duel_print_type(kid,expand);
- X break ;
- X case CTK_STRUCT:
- X if(expand <= 0) {
- X printf("struct %s ",t->name);
- X break ;
- X }
- X printf("struct %s { ",t->name) ;
- X for(i=0 ; i<t->u.f.fields_no ; i++) {
- X tctype_field *f= &t->u.f.fields[i] ;
- X duel_print_type(f->ctype,expand-1);
- X printf("%s ",f->name);
- X if(f->bitlen != 0) printf(":%d ",f->bitlen);
- X printf("; ");
- X }
- X printf("} ; ");
- X break ;
- X case CTK_UNION: printf("union %s",t->name) ; break ;
- X default: duel_assert(0);
- X }
- X}
- X
- X
- X/* print the given scalar value into string s.
- X * for none-scalar values, print the lval's address.
- X * note: v's value is not modified.
- X */
- X
- XPROC duel_sprint_scalar_value(char *s,tvalue *v)
- X{
- X bool ok ;
- X tvalue rval ; /* copy of v, but as an rval */
- X rval = *v ;
- X if(v->val_kind==VK_FVALUE) {
- X sprintf(s,"frame(%d)",v->u.fvalue);
- X return ;
- X }
- X if(v->val_kind==VK_LVALUE) {
- X if(v->u.lvalue==NULL) sprintf(s,"illegal ref - null");
- X switch(v->ctype->type_kind) {
- X case CTK_STRUCT: sprintf(s,"struct @%p",v->u.lvalue); return;
- X case CTK_UNION: sprintf(s,"union @%p",v->u.lvalue ); return;
- X case CTK_FUNC: sprintf(s,"func @%p",v->u.lvalue) ; return;
- X case CTK_ARRAY:
- X if(v->ctype->u.kid!=ctype_char) {
- X sprintf(s,"array @%p",v->u.lvalue);
- X return;
- X }
- X }
- X ok=duel_try_get_rvalue(&rval,"");
- X if(!ok) {
- X sprintf(s,"illegal ref @%p",v->u.lvalue);
- X return ;
- X }
- X }
- X else
- X if(v->val_kind==VK_BVALUE) {
- X ok=duel_try_get_rvalue(&rval,"");
- X if(!ok) {
- X sprintf(s,"illegal ref @%p",v->u.bvalue.lvalue);
- X return ;
- X }
- X }
- X
- X switch(rval.ctype->type_kind) {
- X case CTK_VOID: sprintf(s,"void") ; break ;
- X case CTK_CHAR: if(rval.u.rval_char==0) sprintf(s,"'\\0'");
- X else
- X if(!isprint(rval.u.rval_char)|| !isascii(rval.u.rval_char))
- X sprintf(s,"'\\%3.3o'",rval.u.rval_char & 0377);
- X else sprintf(s,"'%c'", rval.u.rval_char) ;
- X break ;
- X case CTK_SHORT: sprintf(s,"%d", rval.u.rval_short) ; break ;
- X case CTK_INT: sprintf(s,"%d", rval.u.rval_int) ; break ;
- X case CTK_LONG: sprintf(s,"%ldL", rval.u.rval_long) ; break ;
- X case CTK_UCHAR: if(rval.u.rval_uchar==0) sprintf(s,"'\\0'");
- X else sprintf(s,"'\\x%d'", rval.u.rval_uchar) ; break ;
- X case CTK_USHORT: if(rval.u.rval_ushort==0) sprintf(s,"0");
- X else sprintf(s,"0x%x", rval.u.rval_ushort) ; break ;
- X case CTK_UINT: if(rval.u.rval_uint==0) sprintf(s,"0");
- X else sprintf(s,"0x%x", rval.u.rval_uint) ; break ;
- X case CTK_ULONG: if(rval.u.rval_ulong==0L) sprintf(s,"0");
- X else sprintf(s,"0x%lxL", rval.u.rval_ulong) ; break ;
- X case CTK_FLOAT: rval.u.rval_double=rval.u.rval_float ;
- X case CTK_DOUBLE: if(fabs(rval.u.rval_double)<=1e-6 ||
- X fabs(rval.u.rval_double)>=1e8)
- X sprintf(s,"%.4le",rval.u.rval_double);
- X else {
- X int l;
- X sprintf(s,"%.8lf",rval.u.rval_double) ;
- X l=strlen(s)-1;
- X while(s[l]=='0' && s[l-1]!='.') s[l--]=0 ;
- X }
- X break ;
- X case CTK_PTR:
- X if(rval.u.rval_ptr==NULL) sprintf(s,"NULL");
- X else
- X if(rval.ctype->u.kid==ctype_char) {
- X char sval[31] ;
- X duel_get_target_bytes(rval.u.lvalue,sval,30);
- X sval[30]=0 ;
- X sprintf(s,"\"%s\"",sval);
- X }
- X else sprintf(s,"@%p",rval.u.rval_ptr);
- X break ;
- X case CTK_ENUM: {
- X int i, n=rval.ctype->u.e.enumerators_no ;
- X tctype_enumerator *e=rval.ctype->u.e.enumerators ;
- X int val=duel_get_int_val(v,"");
- X for(i=0 ; i<n ; i++)
- X if(e[i].val == val) { strcpy(s,e[i].name); return ;}
- X sprintf(s,"%d",val);
- X }
- X break ;
- X default: duel_assert(0);
- X }
- X}
- X
- X/* print the given value, symbolic+val. Handles structures */
- X
- XPROC duel_print_value(tvalue *v)
- X{
- X tctype *t=v->ctype ;
- X int i ;
- X char s[160];
- X
- X if(duel_debug) {
- X printf("`` %s '' ",v->symb_val);
- X printf("{ ");
- X duel_print_type(v->ctype,2);
- X printf("} ");
- X if(v->val_kind==VK_LVALUE) {
- X printf("lval @%p",v->u.lvalue);
- X }
- X else
- X if(v->val_kind==VK_BVALUE) {
- X printf("bval @%p [%d,%d]",v->u.bvalue.lvalue,v->u.bvalue.bitpos,
- X v->u.bvalue.bitlen);
- X }
- X printf("\n");
- X }
- X
- X if(v->val_kind==VK_LVALUE) {
- X switch(t->type_kind) {
- X case CTK_STRUCT:
- X printf("%s = { ",v->symb_val);
- X for(i=0 ; i<t->u.f.fields_no ; i++) {
- X tvalue u ;
- X char *name=t->u.f.fields[i].name ;
- X duel_get_dot_name(v,name,&u);
- X duel_sprint_scalar_value(s,&u);
- X printf("%s = %s",name,s) ;
- X if(strncmp(s,"illegal",6)==0) break ;
- X if(i < t->u.f.fields_no-1) printf(", ");
- X }
- X printf(" }");
- X return ;
- X case CTK_ARRAY:
- X case CTK_UNION: ; /* for now, do nothing for these */
- X }
- X }
- X
- X duel_sprint_scalar_value(s,v);
- X if(strcmp(v->symb_val,s)==0) printf("%s",s);
- X else
- X printf("%s = %s",v->symb_val,s);
- X
- X}
- X
- SHAR_EOF
- $TOUCH -am 0113165193 src/print.c &&
- chmod 0644 src/print.c ||
- echo "restore of src/print.c failed"
- set `wc -c src/print.c`;Wc_c=$1
- if test "$Wc_c" != "7498"; then
- echo original size 7498, current size $Wc_c
- fi
- # ============= src/types.c ==============
- echo "x - extracting src/types.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > src/types.c &&
- X/* DUEL - A Very High Level Debugging Langauge. */
- X/* Public domain code */
- X/* Written by Michael Golan mg@cs.princeton.edu */
- X/*$Header: /tmp_mnt/n/fs/grad2/mg/duel/RCS/types.c,v 1.6 93/01/12 21:54:25 mg Exp $*/
- X
- X/* this module contains the duel type system management
- X */
- X
- X/*
- X * $Log: types.c,v $
- X * Revision 1.6 93/01/12 21:54:25 mg
- X * cleanup and set for release
- X *
- X * Revision 1.5 93/01/03 07:31:24 mg
- X * *** empty log message ***
- X *
- X * Revision 1.4 92/10/19 15:09:28 mg
- X * support zero fields/enumerators because gdb have them sometimes.
- X *
- X * Revision 1.3 92/10/14 02:07:00 mg
- X * misc
- X *
- X * Revision 1.2 92/09/16 11:11:43 mg
- X * added builtin charptr type
- X *
- X */
- X
- X#include "duel.h"
- X
- XFUNC tctype* duel_mkctype_ptr(tctype *t)
- X{
- X tctype *n ;
- X n=(tctype *) duel_malloc(sizeof(tctype));
- X duel_bzero((char*) n,sizeof(tctype));
- X n->type_kind=CTK_PTR ;
- X n->size=sizeof(void*);
- X n->u.kid=t ;
- X return n ;
- X}
- X
- XFUNC tctype* duel_mkctype_func(tctype *t)
- X{
- X tctype *n ;
- X n=(tctype *) duel_malloc(sizeof(tctype));
- X duel_bzero((char*) n,sizeof(tctype));
- X n->size=0 ;
- X n->type_kind=CTK_FUNC ;
- X n->u.kid=t ;
- X return n ;
- X}
- X
- X/* create a struct or union type. The fields are not set here, but
- X * filled individually with the next function
- X * note the having zero fields is supported. This shouldnt be legal in C
- X * but compilers allow pointer to sturct w/o every specifying the struct.
- X * this is especially true for gdb itself!
- X */
- X
- XFUNC tctype* duel_mkctype_struct(char *name,size_t size,int fields_no,
- X bool is_union)
- X{
- X tctype *n ;
- X n=(tctype *) duel_malloc(sizeof(tctype));
- X duel_bzero((char*) n,sizeof(tctype));
- X n->name=name ;
- X n->size=size ;
- X if(is_union) n->type_kind=CTK_UNION ;
- X else n->type_kind=CTK_STRUCT ;
- X n->u.f.fields_no=fields_no ;
- X if(fields_no==0) n->u.f.fields=NULL ;
- X else {
- X n->u.f.fields=(tctype_field *) duel_malloc(fields_no*sizeof(tctype_field));
- X duel_bzero((char*) n->u.f.fields,fields_no*sizeof(tctype_field));
- X }
- X return n ;
- X}
- X
- X/* insert field (field_no) into sturct/union (t), with type fctype
- X */
- XPROC duel_mkctype_struct_field(tctype *t,int field_no,char *name,
- X int bitpos,int bitlen, tctype *fctype)
- X{
- X tctype_field *f ;
- X duel_assert(t->type_kind==CTK_STRUCT || t->type_kind==CTK_UNION);
- X duel_assert(field_no>=0 && field_no <= t->u.f.fields_no);
- X f= &t->u.f.fields[field_no] ;
- X f->name=name ;
- X f->bitpos=bitpos ;
- X f->bitlen=bitlen ;
- X f->ctype=fctype ;
- X}
- X
- X/* create an enum type. The enumerators are not set here, but
- X * filled individually with the next function
- X * again like sturct, we support zero enums. I am not sure its needed,
- X * but better safe than sorry.
- X */
- X
- XFUNC tctype* duel_mkctype_enum(char *name,tctype_kind real_type_kind,
- X size_t size,int enumerators_no)
- X{
- X tctype *n ;
- X n=(tctype *) duel_malloc(sizeof(tctype));
- X duel_bzero((char*) n,sizeof(tctype));
- X n->name=name ;
- X n->size=size ;
- X n->type_kind=CTK_ENUM ;
- X n->u.e.real_type_kind=real_type_kind ;
- X n->u.e.enumerators_no=enumerators_no ;
- X if(enumerators_no==0) n->u.e.enumerators=NULL ;
- X else {
- X n->u.e.enumerators= (tctype_enumerator *)
- X duel_malloc(enumerators_no*sizeof(tctype_enumerator));
- X duel_bzero((char*) n->u.e.enumerators,
- X enumerators_no*sizeof(tctype_enumerator));
- X }
- X return n ;
- X}
- X
- X
- X/* insert enumerator (enumerator_no_ into an enum type (t), with given name/val
- X */
- XPROC duel_mkctype_enumerator(tctype *t,int enumerator_no,char *name,int val)
- X{
- X tctype_enumerator *e ;
- X duel_assert(t->type_kind==CTK_ENUM);
- X duel_assert(enumerator_no>=0 && enumerator_no <= t->u.e.enumerators_no);
- X e= &t->u.e.enumerators[enumerator_no] ;
- X e->name=name ;
- X e->val=val ;
- X}
- X
- XFUNC tctype* duel_mkctype_array(tctype *t,int size)
- X{
- X tctype *n ;
- X if(t->size==0) duel_gen_error("array of a type of zero size is illegal",0);
- X if(size<=0) duel_gen_error("array of size zero or negative is illegal",0);
- X n=(tctype *) duel_malloc(sizeof(tctype));
- X duel_bzero((char*) n,sizeof(tctype));
- X n->type_kind=CTK_ARRAY ;
- X n->size=size*t->size ;
- X n->u.kid=t ;
- X return n ;
- X}
- X
- X
- XLFUNC tctype* init_basic_ctype(tctype_kind tk,char *name,size_t size)
- X{
- X tctype *p = duel_malloc(sizeof(tctype));
- X p->type_kind=tk ;
- X p->name=name ;
- X p->size=size ;
- X return p ;
- X}
- X
- XPROC duel_init_basic_ctypes(void)
- X{
- X ctype_void= init_basic_ctype(CTK_VOID, "void", 0);
- X
- X ctype_char =init_basic_ctype(CTK_CHAR, "char", sizeof(char));
- X ctype_short=init_basic_ctype(CTK_SHORT, "short",sizeof(short));
- X ctype_int =init_basic_ctype(CTK_INT, "int", sizeof(int));
- X ctype_long =init_basic_ctype(CTK_LONG, "long", sizeof(long));
- X
- X ctype_uchar =init_basic_ctype(CTK_UCHAR, "unsigned char", sizeof(uchar));
- X ctype_ushort=init_basic_ctype(CTK_USHORT, "unsigned short",sizeof(ushort));
- X ctype_uint =init_basic_ctype(CTK_UINT, "unsigned int", sizeof(uint));
- X ctype_ulong =init_basic_ctype(CTK_ULONG, "unsigned long", sizeof(ulong));
- X
- X ctype_double=init_basic_ctype(CTK_DOUBLE, "double", sizeof(double));
- X ctype_float =init_basic_ctype(CTK_FLOAT, "float", sizeof(float));
- X
- X ctype_voidptr=duel_mkctype_ptr(ctype_void);
- X ctype_charptr=duel_mkctype_ptr(ctype_char);
- X /* find and set the special types.
- X * support only a signed ptrdiff; size_t/ptrdiff must both be int or long
- X */
- X { ptrdiff_t p ; size_t s ;
- X p= -1 ; s= -1 ;
- X if(p>0) duel_gen_error("bad ptrdiff_t - unsigned",0);
- X
- X if(sizeof(p)==sizeof(int)) ctype_ptrdiff_t=ctype_int ;
- X else if(sizeof(p)==sizeof(long)) ctype_ptrdiff_t=ctype_long ;
- X else duel_gen_error("bad ptrdiff_t size",0);
- X
- X if(sizeof(s)==sizeof(int)) ctype_size_t= (s<0)? ctype_int:ctype_uint ;
- X else
- X if(sizeof(s)==sizeof(long)) ctype_size_t= (s<0)? ctype_long:ctype_ulong ;
- X else duel_gen_error("bad size_t size",0);
- X }
- X}
- X
- X
- SHAR_EOF
- $TOUCH -am 0113165193 src/types.c &&
- chmod 0644 src/types.c ||
- echo "restore of src/types.c failed"
- set `wc -c src/types.c`;Wc_c=$1
- if test "$Wc_c" != "5857"; then
- echo original size 5857, current size $Wc_c
- fi
- # ============= src/misc.c ==============
- echo "x - extracting src/misc.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > src/misc.c &&
- X/* DUEL - A Very High Level Debugging Langauge. */
- X/* Public domain code */
- X/* Written by Michael Golan mg@cs.princeton.edu */
- X/*$Header: /tmp_mnt/n/fs/grad2/mg/duel/RCS/misc.c,v 1.4 93/01/13 16:22:09 mg Exp $*/
- X
- X/* misc function/library-like */
- X
- X/*
- X * $Log: misc.c,v $
- X * Revision 1.4 93/01/13 16:22:09 mg
- X * allow malloc to return int (is a mini symbol on SUN)
- X *
- X * Revision 1.3 93/01/12 21:52:43 mg
- X * moved aliases mgmt here
- X * cleanup and set for release
- X *
- X */
- X
- X#include "duel.h"
- X
- X/* like strncpy, but put a zero at to[len] anyway.
- X * are copied (hence taking len+1 bytes
- X */
- X
- XFUNC char* strncpyz(char *to,char *from,size_t len)
- X{
- X strncpy(to,from,len);
- X to[len]=0 ;
- X return to ;
- X}
- X
- X/* allocate n bytes in the target's space. Used for storing constant
- X * strings when they are parsed, and for variables declaration
- X * note: on SUN (and others?) gdb claims malloc to return an integer. we
- X * accept this (silly but probably no harm done)
- X */
- X
- XFUNC ttarget_ptr duel_alloc_target_space(size_t n)
- X{
- X tvalue p,f,r,*parms[1] ;
- X
- X p.val_kind=VK_RVALUE ; /* mk n into a value, to pass as parm */
- X p.ctype=ctype_int ;
- X p.u.rval_int=n ;
- X parms[0]= &p ;
- X
- X if(!duel_get_target_variable("malloc",-1,&f) ||
- X f.ctype->type_kind!=CTK_FUNC ||
- X f.ctype->u.kid->type_kind!=CTK_INT && f.ctype->u.kid->type_kind!=CTK_PTR)
- X duel_fatal("malloc() function returning a pointer required in target");
- X
- X duel_target_func_call(&f,parms,1,&r);
- X if(r.u.rval_ptr==NULL) duel_fatal("target's malloc() failed");
- X return r.u.rval_ptr ;
- X}
- X
- XPROC duel_free_val_list(tval_list *l) /*free a val list and mark list empty */
- X{
- X tval_lcell *cell,*next ;
- X for(cell=l->head ; cell!=NULL ; cell=next ) {
- X next=cell->next ;
- X duel_free(cell);
- X }
- X l->head=l->tail=NULL ;
- X}
- X
- X/* free all the memory allocated in the parse tree from node */
- X
- XPROC duel_free_nodes(tnode *n)
- X{
- X int i;
- X if(!n) return ;
- X for(i=0 ; i<NODE_MAX_KIDS ; i++)
- X duel_free_nodes(n->kids[i]);
- X duel_free_val_list(&n->eval.vlist);
- X duel_free(n);
- X}
- X
- X
- X
- X/* Aliases management */
- X
- Xtypedef struct sduel_var { /* an alias */
- X char *name ;
- X tvalue val ;
- X struct sduel_var *next ;
- X } tduel_var ;
- Xtduel_var *duel_vars_head ;
- X
- X/* find the value of a duel variable, if exist (else return null */
- X
- XFUNC tvalue* duel_find_alias(char *name)
- X{
- X tduel_var *p ;
- X for(p=duel_vars_head ; p ; p=p->next) {
- X if(strcmp(name,p->name)==0) return(&p->val);
- X }
- X return NULL ;
- X}
- X
- X/* set a value of a duel alias. Create var as needed */
- X
- XPROC duel_set_alias(char *name,tvalue *v)
- X{
- X tduel_var *p ;
- X tvalue *found = duel_find_alias(name) ;
- X if(found!=NULL) *found= *v ;
- X else {
- X p=duel_malloc(sizeof(tduel_var)) ;
- X p->next=duel_vars_head ;
- X p->val= *v ;
- X p->name=name ;
- X duel_vars_head=p ;
- X }
- X}
- X
- XPROC duel_clear_aliases(void) /* clear all defined aliases */
- X{
- X tduel_var *p=duel_vars_head ;
- X while(p) {
- X tduel_var *q=p ;
- X p=p->next ;
- X duel_free(q);
- X }
- X duel_vars_head=0 ;
- X}
- X
- XPROC duel_show_aliases(void)
- X{
- X tduel_var *p ;
- X if(!duel_vars_head) printf("No aliases defined\n");
- X else {
- X printf("Aliases table:\n");
- X for(p=duel_vars_head ; p ; p=p->next) {
- X printf("%s: ",p->name);
- X duel_print_value(&p->val);
- X printf("\n");
- X }
- X }
- X}
- X
- X
- X
- SHAR_EOF
- $TOUCH -am 0113165193 src/misc.c &&
- chmod 0644 src/misc.c ||
- echo "restore of src/misc.c failed"
- set `wc -c src/misc.c`;Wc_c=$1
- if test "$Wc_c" != "3378"; then
- echo original size 3378, current size $Wc_c
- fi
- # ============= src/duelself.c ==============
- echo "x - extracting src/duelself.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > src/duelself.c &&
- X/* DUEL - A Very High Level Debugging Langauge. */
- X/* Public domain code */
- X/* Written by Michael Golan mg@cs.princeton.edu */
- X/*$Header: /tmp_mnt/n/fs/grad2/mg/duel/RCS/duelself.c,v 1.3 93/01/13 16:21:40 mg Exp $*/
- X
- X/* self-debugger module, it contains all of duel's access to
- X * the outside world (like duelgdb.c), but is intended to work when duel
- X * is linked with the debuggee directly (not with the debugger!)
- X * if you link this with duel.a, you get a test suite of duel
- X * for the C program: (tsuite.c)
- X *
- X * int gint ;
- X * typedef unsigned int uint ;
- X * void main() {
- X * printf ; malloc ; / * include them in bin * /
- X * char *s="main string" ;
- X * }
- X *
- X * You could link this module with your own program and call it at
- X * "appropriate places", then ship the program with this code, and
- X * use duel at client's site when a crash occurs. However, reading in
- X * the symbol table and figuring out the active frames remains a problem.
- X */
- X
- X/*
- X * $Log: duelself.c,v $
- X * Revision 1.3 93/01/13 16:21:40 mg
- X * made sure printf is declared
- X *
- X * Revision 1.2 93/01/12 21:31:01 mg
- X * brought uptodate with duelgdb.c
- X * cleanup and set for release
- X *
- X */
- X/* include system dependent stuff here */
- X
- X#include "duel.h"
- Xvoid main(int argc,char **argv);
- X
- X
- XFUNC void* duel_malloc(size_t size)
- X{
- X void *p=malloc(size);
- X if(p==0) duel_fatal("out of memory.");
- X return p;
- X}
- X
- XPROC duel_free(void *p)
- X{
- X free(p);
- X}
- X/* fetch n bytes from the target at the given memory address.
- X * the address to fetch from is given by (from).
- X * the value is stored at the 'to' location, which points to space for
- X * n bytes in the debugger.
- X * if the address can not be accessed, false is returned (if all ok, ret true)
- X */
- X
- XFUNC bool duel_get_target_bytes(ttarget_ptr from,void *to,size_t n)
- X{
- X duel_bcopy(to,from,n);
- X return TRUE ;
- X}
- X
- X/* store n bytes to the debuggee. reverse parms from above */
- XFUNC bool duel_put_target_bytes(ttarget_ptr to,void *from,size_t n)
- X{
- X duel_bcopy(to,from,n);
- X return TRUE ;
- X}
- X
- X/* fetch the value of a bitfield of a given structure. */
- X
- XFUNC bool duel_get_target_bitfield(ttarget_ptr struct_at,int bitpos,
- X int bitlen,void *to,tctype_kind tkind)
- X{
- X return FALSE ; /* not supported in duelself */
- X}
- X
- X/* make a function call to the target. */
- X/* support only passing/returing sizeof(int) upto 5 paramaters */
- XPROC duel_target_func_call(tvalue *func, tvalue *parms[],
- X int parms_no,tvalue *rval)
- X{
- X int (*f)();
- X int i ;
- X if(parms_no>5) duel_fatal("too many parms");
- X if(sizeof(func->ctype->u.kid)!=sizeof(int) &&
- X func->ctype->u.kid!=ctype_void ) duel_fatal("unsupported func parm");
- X for(i=0 ; i<parms_no ; i++) {
- X if(parms[i]->val_kind!=VK_RVALUE || parms[i]->ctype->size!=sizeof(int))
- X duel_fatal("unsupported paramater");
- X }
- X f=(int (*)()) func->u.lvalue ;
- X switch(parms_no) {
- X case 0:
- X rval->u.rval_int= (*f)();
- X break ;
- X case 1:
- X rval->u.rval_int= (*f)(parms[0]->u.rval_int);
- X break ;
- X case 2:
- X rval->u.rval_int= (*f)(parms[0]->u.rval_int,parms[1]->u.rval_int);
- X break ;
- X case 3:
- X rval->u.rval_int= (*f)(parms[0]->u.rval_int,parms[1]->u.rval_int,
- X parms[2]->u.rval_int);
- X break ;
- X case 4:
- X rval->u.rval_int= (*f)(parms[0]->u.rval_int,parms[1]->u.rval_int,
- X parms[2]->u.rval_int,parms[3]->u.rval_int);
- X break ;
- X case 5:
- X rval->u.rval_int= (*f)(parms[0]->u.rval_int,parms[1]->u.rval_int,
- X parms[2]->u.rval_int,parms[3]->u.rval_int,parms[4]->u.rval_int);
- X break ;
- X }
- X rval->val_kind=VK_RVALUE ;
- X rval->ctype=func->ctype->u.kid ;
- X}
- X
- X/* find debuggee variable.
- X * recognize main.s, gint, malloc, printf
- X */
- X
- Xint gint ; /* global variable recognized */
- Xchar **main_s ; /* point to main's 's' */
- X
- XFUNC bool duel_get_target_variable(char *name, int frame_no, tvalue *v)
- X{
- X v->val_kind=VK_LVALUE ;
- X if(frame_no<=0 && strcmp(name,"s")==0) {
- X v->ctype=duel_mkctype_ptr(ctype_char);
- X v->u.lvalue = (void*) main_s ;
- X return TRUE ;
- X }
- X if(frame_no != -1) return FALSE ;
- X if(strcmp(name,"main")==0) {
- X v->ctype=duel_mkctype_func(ctype_void);
- X v->u.lvalue = (void*) main ;
- X return TRUE ;
- X }
- X if(strcmp(name,"malloc")==0) {
- X v->ctype=duel_mkctype_func(duel_mkctype_ptr(ctype_void));
- X v->u.lvalue = (void*) malloc ;
- X return TRUE ;
- X }
- X if(strcmp(name,"printf")==0) {
- X if(0) printf(""); /* "declare" print */
- X v->ctype=duel_mkctype_func(ctype_int);
- X v->u.lvalue = (void*) printf ;
- X return TRUE ;
- X }
- X if(strcmp(name,"gint")!=0) return FALSE ;
- X v->ctype= ctype_int ; /* type of this variable */
- X v->u.lvalue= (void*) &gint ; /* address of variable */
- X return TRUE ;
- X}
- X
- X
- XFUNC int duel_get_frames_number(void)
- X{
- X return 1 ; /* main */
- X}
- X
- X
- XFUNC ttarget_ptr duel_get_function_for_frame(int frame_no)
- X{
- X if(frame_no==0) return (void*) main ;
- X else duel_fatal("bad frame number - internal err");
- X}
- X
- XFUNC tctype* duel_get_target_typedef(char *name)
- X{
- X if(strcmp(name,"uint")==0) return ctype_uint ;
- X return NULL ;
- X}
- X
- XFUNC tctype* duel_get_target_struct_tag(char *name) { return 0 ; }
- XFUNC tctype* duel_get_target_union_tag(char *name) { return 0 ; }
- XFUNC tctype* duel_get_target_enum_tag(char *name) { return 0 ; }
- X
- Xvoid main(int argc,char **argv)
- X{
- X char *s="main string" ;
- X main_s = &s ; /* put s into the "symbol tbl" */
- X
- X while(1) {
- X char in[120] ;
- X gets(in);
- X if(feof(stdin)) break ;
- X printf("dl> %s\n",in);
- X if(in[0]==0 || in[0]=='#' && in[1]=='#') continue ; /* comments */
- X duel_parse_and_eval(in);
- X }
- X}
- SHAR_EOF
- $TOUCH -am 0113165193 src/duelself.c &&
- chmod 0644 src/duelself.c ||
- echo "restore of src/duelself.c failed"
- set `wc -c src/duelself.c`;Wc_c=$1
- if test "$Wc_c" != "5695"; then
- echo original size 5695, current size $Wc_c
- fi
- # ============= src/tsuite.c ==============
- echo "x - extracting src/tsuite.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > src/tsuite.c &&
- X#include <stdlib.h>
- X#include <stdio.h>
- X
- Xint gint ;
- Xtypedef unsigned int uint ;
- X
- Xvoid main()
- X{
- X char *s="main string" ;
- X FILE *out=stdout ; /* stdout is not a variable */
- X /* use fflush(out) from debugger */
- X malloc ;
- X printf("trivial tsuite program\n");
- X}
- SHAR_EOF
- $TOUCH -am 0113170393 src/tsuite.c &&
- chmod 0644 src/tsuite.c ||
- echo "restore of src/tsuite.c failed"
- set `wc -c src/tsuite.c`;Wc_c=$1
- if test "$Wc_c" != "262"; then
- echo original size 262, current size $Wc_c
- fi
- # ============= src/tsuite.gdb ==============
- echo "x - extracting src/tsuite.gdb (Text)"
- sed 's/^X//' << 'SHAR_EOF' > src/tsuite.gdb &&
- Xset prompt
- X## DUEL - A Very High Level Debugging Langauge.
- X## Public domain code
- X## Written by Michael Golan mg@cs.princeton.edu
- X##$Header$
- X##
- X## test suite for duel, can be used with duelself or gdb
- X##
- Xfile tsuite
- Xb main
- Xr
- Xn
- Xn
- X## check constants
- Xdl (1..5)*(2,(double) 2/3)
- X## declare array x, set it, search it
- Xdl int x[100] ;
- Xdl x[0..99]= -1 ;
- Xdl x[i:=20..40]=2+i*i ;
- Xdl x[20..23,38..40]
- Xdl x[..100] >=? 33*33 <=? 35*35
- Xdl x[..100]=> ((_>=33*33) & (_<= 35*35)) ==? 1
- Xdl (*(x+(7..9)))++
- Xdl y:= &x[7] ;
- Xdl y[0..2]
- Xdl x+7 == y
- Xdl (x[..99]>?0)@(_>100)
- Xdl printf("x is: "); printf("%d, ",x[0..99]>? 0); printf("\n");fflush(out);
- Xdl int j ; for(j=0 ; j<100 ; j++) if(x[j]>37*37) printf("x[%d]=%d\n",j,x[j]);fflush(out);
- X## errors
- Xdl i=4 ;
- Xdl x=6 ;
- Xdl x++ ;
- Xdl --i ;
- X## cleanup
- Xdl alias
- Xdl clear
- X## access some variables
- Xdl s
- Xdl s[4..8]
- Xdl s[6..]@0
- Xdl l:=#/s[0..]@0
- Xdl s[l-2..l]
- Xdl gint
- Xdl gint++
- Xdl gint++
- Xdl --gint
- Xdl gint
- Xdl main.s
- Xdl ++main.s
- Xdl main ==? main
- Xdl main == main
- Xdl frames_no
- Xdl frame(0).s
- Xdl frame(0).gint
- Xdl frame(0).(gint)
- Xdl T uint myuint ; myuint = -1
- X## some errors
- Xdl main == printf
- Xdl main+1
- Xdl main > printf
- Xdl printf+3
- Xdl T int x
- Xdl uint y
- Xdl T uint z = 5
- X## the end
- X
- SHAR_EOF
- $TOUCH -am 0113163293 src/tsuite.gdb &&
- chmod 0644 src/tsuite.gdb ||
- echo "restore of src/tsuite.gdb failed"
- set `wc -c src/tsuite.gdb`;Wc_c=$1
- if test "$Wc_c" != "1206"; then
- echo original size 1206, current size $Wc_c
- fi
- # ============= src/tsuite.self ==============
- echo "x - extracting src/tsuite.self (Text)"
- sed 's/^X//' << 'SHAR_EOF' > src/tsuite.self &&
- X## DUEL - A Very High Level Debugging Langauge.
- X## Public domain code
- X## Written by Michael Golan mg@cs.princeton.edu
- X##$Header$
- X
- X##
- X## test suite for duel, can be used with duelself or gdb
- X##
- X
- X## check constants
- X(1..5)*(2,(double) 2/3)
- X
- X## declare array x, set it, search it
- X
- Xint x[100] ;
- Xx[0..99]= -1 ;
- Xx[i:=20..40]=2+i*i ;
- Xx[20..23,38..40]
- Xx[..100] >=? 33*33 <=? 35*35
- Xx[..100]=> ((_>=33*33) & (_<= 35*35)) ==? 1
- Xx
- Xx+5
- X*(x+7..9)++
- X*(x+(7..9))++
- X(*(x+(7..9)))++
- Xy:= &x[7] ;
- Xy[0..2]
- Xx+7 == y
- X(x[..99]>?0)@(_>100)
- X
- Xprintf("x is: "); printf("%d, ",x[0..99]>? 0); printf("\n");
- Xint j ; for(j=0 ; j<100 ; j++) if(x[j]>37*37) printf("x[%d]=%d\n",j,x[j]);
- X
- X## errors
- X
- X&x
- Xi=4 ;
- Xx=6 ;
- Xx++ ;
- X--i ;
- X
- X## cleanup
- X
- Xalias
- Xclear
- X
- X## access some variables
- Xs
- Xs[4..8]
- Xs[6..]@0
- Xl:=#/s[0..]@0
- Xs[l-2..l]
- X
- Xgint
- Xgint++
- Xgint++
- X--gint
- Xgint
- Xmain.s
- Xmain.s++
- Xmain.s++
- X
- Xmain
- Xprintf
- Xmain ==? main
- Xmain == main
- X
- Xframes_no
- Xframe(0).s
- Xframe(0).gint
- Xframe(0).(gint)
- X
- XT uint myuint ; myuint = -1
- X
- X## some errors
- X
- Xmain == printf
- Xmain+1
- Xmain > printf
- X
- Xmalloc[4]
- X
- Xprintf+3
- X
- XT int x
- Xuint y
- XT uint z = 5
- X
- X## the end
- X
- X
- SHAR_EOF
- $TOUCH -am 0113163293 src/tsuite.self &&
- chmod 0644 src/tsuite.self ||
- echo "restore of src/tsuite.self failed"
- set `wc -c src/tsuite.self`;Wc_c=$1
- if test "$Wc_c" != "1095"; then
- echo original size 1095, current size $Wc_c
- fi
- # ============= src/tsuite.gdb.out ==============
- echo "x - extracting src/tsuite.gdb.out (Text)"
- sed 's/^X//' << 'SHAR_EOF' > src/tsuite.gdb.out &&
- XGDB is free software and you are welcome to distribute copies of it
- X under certain conditions; type "show copying" to see the conditions.
- XThere is absolutely no warranty for GDB; type "show warranty" for details.
- XGDB 4.6, Copyright 1992 Free Software Foundation, Inc.
- X(gdb) Reading symbols from tsuite...done.
- X Breakpoint 1 at 0x4001b8: file tsuite.c, line 9.
- X Starting program: /tmp_mnt/n/fs/grad2/mg/duel/tsuite/tsuite
- X
- XBreakpoint 1, main () at tsuite.c:9
- X9 char *s="main string" ;
- X 10 FILE *out=stdout ; /* stdout is not a variable */
- X 13 printf("trivial tsuite program\n");
- X DUEL 1.00.0, public domain debugging language. "dl" for help
- X1*2 = 2
- X1*(2/3) = 0.66666667
- X2*2 = 4
- X2*(2/3) = 1.33333333
- X3*2 = 6
- X3*(2/3) = 2.0
- X4*2 = 8
- X4*(2/3) = 2.66666667
- X5*2 = 10
- X5*(2/3) = 3.33333333
- X x[20] = 402
- Xx[21] = 443
- Xx[22] = 486
- Xx[23] = 531
- Xx[38] = 1446
- Xx[39] = 1523
- Xx[40] = 1602
- X x[33] = 1091
- Xx[34] = 1158
- X (x[33]>=33*33)&(x[33]<=35*35) = 1
- X(x[34]>=33*33)&(x[34]<=35*35) = 1
- X (*(x+7))++ = -1
- X(*(x+8))++ = -1
- X(*(x+9))++ = -1
- X y[0] = 0
- Xy[1] = 0
- Xy[2] = 0
- X x+7==y = 1
- X x is: 402, 443, 486, 531, 578, 627, 678, 731, 786, 843, 902, 963, 1026, 1091, 1158, 1227, 1298, 1371, 1446, 1523, 1602,
- X x[37]=1371
- Xx[38]=1446
- Xx[39]=1523
- Xx[40]=1602
- X Error: i=4 ;
- X -^-- left size not an lvalue for operator '='
- Xoperand ``i'' -- type: int
- X -- value: 40
- X Error: x=6 ;
- X -^-- bad left operand type for operator '='
- Xoperand ``x'' -- type: int [100]
- X -- value: array @10002000
- X Error: x++ ;
- X -^-- operand x of '++' is not integral
- Xoperand ``x'' -- type: int [100]
- X -- value: array @10002000
- X Error: --i ;
- X ^-- operand of '--' must be an lvalue
- Xoperand ``i'' -- type: int
- X -- value: 40
- X Aliases table:
- Xj: j = 100
- Xy: &x[7] = @1000201c
- Xi: 40
- Xx: x = array @10002000
- X Aliases table cleared
- X s = "main string"
- X s[4] = ' '
- Xs[5] = 's'
- Xs[6] = 't'
- Xs[7] = 'r'
- Xs[8] = 'i'
- X s[6] = 't'
- Xs[7] = 'r'
- Xs[8] = 'i'
- Xs[9] = 'n'
- Xs[10] = 'g'
- X 11
- X s[9] = 'n'
- Xs[10] = 'g'
- Xs[11] = '\0'
- X gint = 0
- X gint++ = 0
- X gint++ = 1
- X gint = 1
- X gint = 1
- X main.s = "main string"
- X main.s = "ain string"
- X main = func @004001b0
- X main==main = 1
- X frames_no = 1
- X frame(0).s = "ain string"
- X Error: frame(0).gint
- X --------^-- field not found in operator '.'
- Xoperand ``frame(0)'' -- type: int
- X -- value: frame(0)
- X frame(0).gint = 1
- X -1 = 0xffffffff
- X Error: main == printf
- X -----^-- incompatible types for op ==
- Xoperand1 ``main'' -- type: ptr to func returning void
- X -- value: @004001b0
- Xoperand2 ``printf'' -- type: ptr to func returning int
- X -- value: @004004a0
- X Error: main+1
- X ----^-- unknown pointer object size for '+' op
- Xoperand ``main'' -- type: ptr to func returning void
- X -- value: @004001b0
- X Error: main > printf
- X -----^-- incompatible types for op >
- Xoperand1 ``main'' -- type: ptr to func returning void
- X -- value: @004001b0
- Xoperand2 ``printf'' -- type: ptr to func returning int
- X -- value: @004004a0
- X Error: printf+3
- X ------^-- unknown pointer object size for '+' op
- Xoperand ``printf'' -- type: ptr to func returning int
- X -- value: @004004a0
- X T int x
- X-----^ syntax error
- X uint y
- X------^ syntax error
- X T uint z = 5
- X----------^ syntax error
- X
- SHAR_EOF
- $TOUCH -am 0113163293 src/tsuite.gdb.out &&
- chmod 0644 src/tsuite.gdb.out ||
- echo "restore of src/tsuite.gdb.out failed"
- set `wc -c src/tsuite.gdb.out`;Wc_c=$1
- if test "$Wc_c" != "3214"; then
- echo original size 3214, current size $Wc_c
- fi
- # ============= src/tsuite.self.out ==============
- echo "x - extracting src/tsuite.self.out (Text)"
- sed 's/^X//' << 'SHAR_EOF' > src/tsuite.self.out &&
- Xdl> ## DUEL - A Very High Level Debugging Langauge.
- Xdl> ## Public domain code
- Xdl> ## Written by Michael Golan mg@cs.princeton.edu
- Xdl> ##$Header$
- Xdl>
- Xdl> ##
- Xdl> ## test suite for duel, can be used with duelself or gdb
- Xdl> ##
- Xdl>
- Xdl> ## check constants
- Xdl> (1..5)*(2,(double) 2/3)
- XDUEL 1.00.0, public domain debugging language. "dl" for help
- X1*2 = 2
- X1*(2/3) = 0.66666667
- X2*2 = 4
- X2*(2/3) = 1.33333333
- X3*2 = 6
- X3*(2/3) = 2.0
- X4*2 = 8
- X4*(2/3) = 2.66666667
- X5*2 = 10
- X5*(2/3) = 3.33333333
- Xdl>
- Xdl> ## declare array x, set it, search it
- Xdl>
- Xdl> int x[100] ;
- Xdl> x[0..99]= -1 ;
- Xdl> x[i:=20..40]=2+i*i ;
- Xdl> x[20..23,38..40]
- Xx[20] = 402
- Xx[21] = 443
- Xx[22] = 486
- Xx[23] = 531
- Xx[38] = 1446
- Xx[39] = 1523
- Xx[40] = 1602
- Xdl> x[..100] >=? 33*33 <=? 35*35
- Xx[33] = 1091
- Xx[34] = 1158
- Xdl> x[..100]=> ((_>=33*33) & (_<= 35*35)) ==? 1
- X(x[33]>=33*33)&(x[33]<=35*35) = 1
- X(x[34]>=33*33)&(x[34]<=35*35) = 1
- Xdl> x
- Xx = array @10014000
- Xdl> x+5
- Xx+5 = @10014014
- Xdl> *(x+7..9)++
- XError: *(x+7..9)++
- X -----^-- operand x of 'x..y' is not integral
- Xoperand ``x+7'' -- type: int *
- X -- value: @1001401c
- Xdl> *(x+(7..9))++
- XError: *(x+(7..9))++
- X -----------^-- operand of '++' must be an lvalue
- Xoperand ``(x+7)'' -- type: int *
- X -- value: @1001401c
- Xdl> (*(x+(7..9)))++
- X(*(x+7))++ = -1
- X(*(x+8))++ = -1
- X(*(x+9))++ = -1
- Xdl> y:= &x[7] ;
- Xdl> y[0..2]
- Xy[0] = 0
- Xy[1] = 0
- Xy[2] = 0
- Xdl> x+7 == y
- Xx+7==y = 1
- Xdl> (x[..99]>?0)@(_>100)
- Xdl>
- Xdl> printf("x is: "); printf("%d, ",x[0..99]>? 0); printf("\n");
- Xx is: 402, 443, 486, 531, 578, 627, 678, 731, 786, 843, 902, 963, 1026, 1091, 1158, 1227, 1298, 1371, 1446, 1523, 1602,
- Xdl> int j ; for(j=0 ; j<100 ; j++) if(x[j]>37*37) printf("x[%d]=%d\n",j,x[j]);
- Xx[37]=1371
- Xx[38]=1446
- Xx[39]=1523
- Xx[40]=1602
- Xdl>
- Xdl> ## errors
- Xdl>
- Xdl> &x
- X&x = @10014000
- Xdl> i=4 ;
- XError: i=4 ;
- X -^-- left size not an lvalue for operator '='
- Xoperand ``i'' -- type: int
- X -- value: 40
- Xdl> x=6 ;
- XError: x=6 ;
- X -^-- bad left operand type for operator '='
- Xoperand ``x'' -- type: int [100]
- X -- value: array @10014000
- Xdl> x++ ;
- XError: x++ ;
- X -^-- operand x of '++' is not integral
- Xoperand ``x'' -- type: int [100]
- X -- value: array @10014000
- Xdl> --i ;
- XError: --i ;
- X ^-- operand of '--' must be an lvalue
- Xoperand ``i'' -- type: int
- X -- value: 40
- Xdl>
- Xdl> ## cleanup
- Xdl>
- Xdl> alias
- XAliases table:
- Xj: j = 100
- Xy: &x[7] = @1001401c
- Xi: 40
- Xx: x = array @10014000
- Xdl> clear
- XAliases table cleared
- Xdl>
- Xdl> ## access some variables
- Xdl> s
- Xs = "main string"
- Xdl> s[4..8]
- Xs[4] = ' '
- Xs[5] = 's'
- Xs[6] = 't'
- Xs[7] = 'r'
- Xs[8] = 'i'
- Xdl> s[6..]@0
- Xs[6] = 't'
- Xs[7] = 'r'
- Xs[8] = 'i'
- Xs[9] = 'n'
- Xs[10] = 'g'
- Xdl> l:=#/s[0..]@0
- X11
- Xdl> s[l-2..l]
- Xs[9] = 'n'
- Xs[10] = 'g'
- Xs[11] = '\0'
- Xdl>
- Xdl> gint
- Xgint = 0
- Xdl> gint++
- Xgint++ = 0
- Xdl> gint++
- Xgint++ = 1
- Xdl> --gint
- Xgint = 1
- Xdl> gint
- Xgint = 1
- Xdl> main.s
- Xmain.s = "main string"
- Xdl> main.s++
- Xmain.s++ = "main string"
- Xdl> main.s++
- Xmain.s++ = "ain string"
- Xdl>
- Xdl> main
- Xmain = func @00400918
- Xdl> printf
- Xprintf = func @00410670
- Xdl> main ==? main
- Xmain = func @00400918
- Xdl> main == main
- Xmain==main = 1
- Xdl>
- Xdl> frames_no
- Xframes_no = 1
- Xdl> frame(0).s
- Xframe(0).s = "in string"
- Xdl> frame(0).gint
- XError: frame(0).gint
- X --------^-- field not found in operator '.'
- Xoperand ``frame(0)'' -- type: int
- X -- value: frame(0)
- Xdl> frame(0).(gint)
- Xframe(0).gint = 1
- Xdl>
- Xdl> T uint myuint ; myuint = -1
- X-1 = 0xffffffff
- Xdl>
- Xdl> ## some errors
- Xdl>
- Xdl> main == printf
- XError: main == printf
- X -----^-- incompatible types for op ==
- Xoperand1 ``main'' -- type: ptr to func returning void
- X -- value: @00400918
- Xoperand2 ``printf'' -- type: ptr to func returning int
- X -- value: @00410670
- Xdl> main+1
- XError: main+1
- X ----^-- unknown pointer object size for '+' op
- Xoperand ``main'' -- type: ptr to func returning void
- X -- value: @00400918
- Xdl> main > printf
- XError: main > printf
- X -----^-- incompatible types for op >
- Xoperand1 ``main'' -- type: ptr to func returning void
- X -- value: @00400918
- Xoperand2 ``printf'' -- type: ptr to func returning int
- X -- value: @00410670
- Xdl>
- Xdl> malloc[4]
- XError: malloc[4]
- X ------^-- unknown pointer object size for '+' op
- Xoperand ``malloc'' -- type: ptr to func returning void *
- X -- value: @004106d0
- Xdl>
- Xdl> printf+3
- XError: printf+3
- X ------^-- unknown pointer object size for '+' op
- Xoperand ``printf'' -- type: ptr to func returning int
- X -- value: @00410670
- Xdl>
- Xdl> T int x
- XT int x
- X-----^ syntax error
- Xdl> uint y
- Xuint y
- X------^ syntax error
- Xdl> T uint z = 5
- XT uint z = 5
- X----------^ syntax error
- Xdl>
- Xdl> ## the end
- Xdl>
- Xdl>
- SHAR_EOF
- $TOUCH -am 0113163293 src/tsuite.self.out &&
- chmod 0644 src/tsuite.self.out ||
- echo "restore of src/tsuite.self.out failed"
- set `wc -c src/tsuite.self.out`;Wc_c=$1
- if test "$Wc_c" != "4576"; then
- echo original size 4576, current size $Wc_c
- fi
- exit 0
-