🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #68

(none)

#68
From: Peggy Fieland
Date: Thu, 09 Apr 1992 18:51
221 lines
8158 bytes
Enclosed is an enhancement to handle variables and arguments based
off baseregisters other than the frame pointer, ie, to handle
dwarf's OP_BASEREG.  This is generated by pcc for structures passed
by value to a procedure.  For our processor (i860), the register in
this case is base register 28.  

Here are the diffs:

diff sc-gdb/gdb/dwarfread.c gdb/dwarfread.c
521c521
< EXFUN(locval, (char *loc AND short dietag AND int *type_class));
---
> EXFUN(locval, (char *loc AND short dietag AND int *type_class AND long *basereg));
1347a1348,1349
>         long basereg; 
> 
1362c1364
<            list -> field.bitpos = 8 * locval (mbr.at_location,mbr.dietag,&class_type );
---
>            list -> field.bitpos = 8 * locval (mbr.at_location,mbr.dietag,&class_type , &basereg);
2978c2980
< 	static int locval (char *loc AND short dietag AND int *class_type)
---
> 	static int locval (char *loc AND short dietag AND int *class_type AND long *basereg)
2996,2997c2998,2999
<      is not handled at all.  The only basereg that Gdb appears able  to
<      handle is  based off the frame_pointer.
---
>      is not handled at all.  This routine now handles OP_BASEREG, returning it's value
>      in the basereg parameter.
3010c3012
< DEFUN(locval, (loc), char *loc AND short dietag AND int *class_type)
---
> DEFUN(locval, (loc), char *loc AND short dietag AND int *class_type AND long *basereg)
3028c3030
< 
---
>   *basereg = 0;
3064c3066
<                 SQUAWK (("BASEREG %d not handled!", regno));
---
>                 *basereg = INTERNAL_REGISTER_VAL(regno);
3538a3541
>    long basereg; /* Fieland */
3550c3553
<                                                     &class_type ),
---
>                                                     &class_type , &basereg),
3794c3797,3798
<   
---
>   long basereg;
> 
3831c3835,3836
< 	      SYMBOL_VALUE (sym) = locval (dip -> at_location,dip->dietag, &class_type);
---
> 	      SYMBOL_VALUE (sym) = locval (dip -> at_location,dip->dietag, &class_type, &basereg);
>            SYMBOL_BASEREG(sym) = basereg;
3856c3861,3862
< 	      SYMBOL_VALUE (sym) = locval (dip -> at_location, dip->dietag, &class_type);
---
> 	      SYMBOL_VALUE (sym) = locval (dip -> at_location, dip->dietag, &class_type, &basereg);
>            SYMBOL_BASEREG(sym) = basereg;
diff sc-gdb/gdb/findvar.c gdb/findvar.c
403a404
>   int optim;
440,443c441,451
<       fi = get_frame_info (frame);
<       if (fi == NULL)
< 	return 0;
<       addr = FRAME_ARGS_ADDRESS (fi);
---
>       if (SYMBOL_BASEREG_NULL(var))
>          {
>             fi = get_frame_info (frame);
>             if (fi == NULL)
>                return 0;
>             addr = FRAME_ARGS_ADDRESS (fi);
>          }
>       else
>          {
>             addr = GET_BASEREG_VALUE( frame, SYMBOL_BASEREG(var));
>          }
451,454c459,469
<       fi = get_frame_info (frame);
<       if (fi == NULL)
< 	return 0;
<       addr = FRAME_ARGS_ADDRESS (fi);
---
>       if (SYMBOL_BASEREG_NULL(var))
>          {
>             fi = get_frame_info (frame);
>             if (fi == NULL)
>                return 0;
>             addr = FRAME_ARGS_ADDRESS (fi);
>          }
>       else
>          {
>             addr = GET_BASEREG_VALUE( frame, SYMBOL_BASEREG(var));
>          }
456c471
< 	return 0;
---
>          return 0;
464,467c479,491
<       fi = get_frame_info (frame);
<       if (fi == NULL)
< 	return 0;
<       addr = SYMBOL_VALUE (var) + FRAME_LOCALS_ADDRESS (fi);
---
>       if (SYMBOL_BASEREG_NULL(var))
>          {
>             fi = get_frame_info (frame);
>             if (fi == NULL)
>                return 0;
>             addr = FRAME_LOCALS_ADDRESS (fi);
>          }
>       else
>          {
>             addr = GET_BASEREG_VALUE( frame, SYMBOL_BASEREG(var));
>          }
>       addr += SYMBOL_VALUE (var);
>             
514a539
> 
diff sc-gdb/gdb/i860-tdep.c gdb/i860-tdep.c
1988a1989,2011
> /* Written by Peggy Fieland (Margaret_Fieland@vos.stratus.com) */
> /* get the contents of a base register.  Used for dwarf OP_BASEREG */
> /* At present, only OP_BASEREG generated is for R28.  NOTE that for stuff based on R28,
>    the value we want is the VALUE AT PROCEDURE INVOKATION, and thus is the frame we
>    use to get the value is the caller's frame. */
> CORE_ADDR get_saved_basereg (frame, basereg)
> FRAME frame;
> int basereg;
> {
>    CORE_ADDR addr;
>    if (basereg == R28)   /* Unconditionally ??? */
>       {
>          frame = get_prev_frame (frame);
>          get_saved_register((char *) &addr, (int *) NULL,  (CORE_ADDR *) NULL, frame,
>                             basereg, (enum lval_type *)NULL);
> 
>       }
>    else
>       get_saved_register((char *) &addr, (int *) NULL,  (CORE_ADDR *) NULL, frame,
>                          basereg, (enum lval_type *)NULL);
> 
>    return (addr);
> }
diff sc-gdb/gdb/printcmd.c gdb/printcmd.c
789c789
<   register long val;
---
>   register long val, basereg;
821a822
>   basereg = SYMBOL_BASEREG(sym);
847c848,852
<       printf ("an argument at offset %ld", val);
---
>       if (SYMBOL_BASEREG_NULL(sym))
>          printf ("an argument at offset %ld", val);
>       else 
>          printf ("an argument at offset %ld from register %s",
>                  val, reg_names[basereg]);
851c856,860
<       printf ("an argument at frame offset %ld", val);
---
>       if (SYMBOL_BASEREG_NULL(sym))
>          printf ("an argument at frame offset %ld", val);
>       else 
>          printf ("an argument at offset %ld from register %s",
>                  val, reg_names[basereg]);
855c864,868
<       printf ("a local variable at frame offset %ld", val);
---
>       if (SYMBOL_BASEREG_NULL(sym))
>          printf ("a local variable at frame offset %ld", val);
>       else
>          printf ("a local variable at offset %ld from register %s",
>                  val, reg_names[basereg]);
diff sc-gdb/gdb/symmisc.c gdb/symmisc.c
264c264,268
< 	  fprintf (outfile, "arg at 0x%lx,", SYMBOL_VALUE (symbol));
---
>        if (SYMBOL_BASEREG_NULL(symbol))
>           fprintf (outfile, "arg at 0x%lx,", SYMBOL_VALUE (symbol));
>        else
>           fprintf (outfile, "arg at 0x%x from register %ld", SYMBOL_VALUE(symbol),
>                    SYMBOL_BASEREG(symbol));
268,269c272,277
< 	  fprintf (outfile, "arg at offset 0x%x from fp,",
< 		   SYMBOL_VALUE (symbol));
---
>        if (SYMBOL_BASEREG_NULL(symbol))
>           fprintf (outfile, "arg at offset 0x%x from fp,",
>                    SYMBOL_VALUE (symbol));
>        else
>           fprintf (outfile, "arg at 0x%x from register %ld", SYMBOL_VALUE(symbol),
>                    SYMBOL_BASEREG(symbol));
280c288,292
< 	  fprintf (outfile, "local at 0x%lx,", SYMBOL_VALUE (symbol));
---
>        if (SYMBOL_BASEREG_NULL(symbol) )
>           fprintf (outfile, "local at 0x%lx,", SYMBOL_VALUE (symbol));
>        else
>           fprintf (outfile, "local at 0x%lx from register %ld", SYMBOL_VALUE(symbol),
>                    SYMBOL_BASEREG(symbol));
diff sc-gdb/gdb/symtab.h gdb/symtab.h
430a431
>   long basereg;       /* Added by Peggy Fieland for dwarf OP_BASEREG */
667a669,670
> #define SYMBOL_BASEREG(symbol) (symbol)->basereg   
> #define SYMBOL_BASEREG_NULL(symbol) ((symbol)->basereg == 0)   
diff sc-gdb/gdb/tm-i860.h gdb/tm-i860.h
223c223
<  ((N) < 32 ? builtin_type_int : (N) < 64 ? builtin_type_float : builtin_type_int)
---
>  ((N) < F0 ? builtin_type_int : (N) <= F31 ? builtin_type_float : builtin_type_int)
482a483
> #define GET_BASEREG_VALUE(frame,basereg)   get_saved_basereg(frame, basereg);
Technical Details
Message-ID: <9204091851.AA02511@citron.sw.stratus.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!citron.sw.stratus.com!pfieland

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!citron.sw.stratus.com!pfieland
From: pfieland@citron.sw.stratus.com (Peggy Fieland)
Subject: (none)
Message-ID: <9204091851.AA02511@citron.sw.stratus.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 9 Apr 1992 18:51:54 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 222