[gnu.gdb.bug] Patches to GDB 3.3

bruno@nestvx.enet.dec.com (Bruno E. Achauer) (12/06/89)

Hi,

below you find some patches to make GDB work on droppings from vcc and lk.
(Vcc and lk are ports of the VAX/VMS C compiler and linker to Ultrix. 
Unfortunately, I have to use these instead of gcc.)

Happy Hacking,
--Bruno.

---- snip ---- snip ---- snip ---- snip ---- snip ---- snip ---- snip ----
*** m-vax.h~	Thu Aug 31 23:38:23 1989
--- m-vax.h	Tue Oct 10 18:19:40 1989
***************
*** 63,68
  /* Offset from address of function to start of its code.
     Zero on most machines.  */
  
  #define FUNCTION_START_OFFSET 2
  
  /* Advance PC across any function entry prologue instructions

--- 63,77 -----
  /* Offset from address of function to start of its code.
     Zero on most machines.  */
  
+ /* Debugger info might be created by Ultrix-32 lk (yucc !). */
+ 
+ # define ULTRIX_LK
+ 
+ /* lk creates N_NOMAP symbols for variables which were optimized away: */
+ 
+ # define IGNORE_SYMBOL(TYPE) \
+      (((TYPE) == N_NOMAP) || ((TYPE) == N_NSYMS))
+ 
  #define FUNCTION_START_OFFSET 2
  
  /* Advance PC across any function entry prologue instructions
*** dbxread.c~	Sat Sep 30 19:08:40 1989
--- dbxread.c	Tue Oct 10 17:59:19 1989
***************
*** 756,762
      {
        /* Type is defined outside of header files.
  	 Find it in this object file's type vector.  */
!       if (index >= type_vector_length)
  	{
  	  type_vector_length *= 2;
  	  type_vector = (struct typevector *)

--- 756,762 -----
      {
        /* Type is defined outside of header files.
  	 Find it in this object file's type vector.  */
!       while (index >= type_vector_length)
  	{
  	  type_vector_length *= 2;
  	  type_vector = (struct typevector *)
***************
*** 1931,1936
    struct partial_symtab **dependency_list;
    int dependencies_used, dependencies_allocated;
  
  #ifdef PROFILE_TYPES
    for (i = 0; i < 256; i++)
      profile_types[i] = 0;

--- 1931,1940 -----
    struct partial_symtab **dependency_list;
    int dependencies_used, dependencies_allocated;
  
+ #ifdef ULTRIX_LK
+   int sline_highval = 0;	/* to guesstimate last module's end address */
+ #endif
+ 
  #ifdef PROFILE_TYPES
    for (i = 0; i < 256; i++)
      profile_types[i] = 0;
***************
*** 1984,1989
        /*
         * Special case to speed up readin.
         */
        if (bufp->n_type == N_SLINE) continue;
  
        /* Ok.  There is a lot of code duplicated in the rest of this

--- 1988,2000 -----
        /*
         * Special case to speed up readin.
         */
+ #ifdef ULTRIX_LK
+       if (bufp->n_type == N_SLINE)
+       {
+ 	  if (bufp->n_value > sline_highval) sline_highval = bufp->n_value;
+ 	  continue;
+       }
+ #else
        if (bufp->n_type == N_SLINE) continue;
  #endif /* ULTRIX_LK */
  
***************
*** 1985,1990
         * Special case to speed up readin.
         */
        if (bufp->n_type == N_SLINE) continue;
  
        /* Ok.  There is a lot of code duplicated in the rest of this
           switch statiement (for efficiency reasons).  Since I don't

--- 1996,2002 -----
        }
  #else
        if (bufp->n_type == N_SLINE) continue;
+ #endif /* ULTRIX_LK */
  
        /* Ok.  There is a lot of code duplicated in the rest of this
           switch statiement (for efficiency reasons).  Since I don't
***************
*** 2115,2120
  		}
  	      if (past_first_source_file && pst)
  		{
  		  end_psymtab (pst, psymtab_include_list, includes_used,
  			       symnum * sizeof (struct nlist), bufp->n_value,
  			       dependency_list, dependencies_used,

--- 2127,2141 -----
  		}
  	      if (past_first_source_file && pst)
  		{
+ 		  int capping_text = bufp->n_value;
+ 
+ #ifdef ULTRIX_LK
+                   /* lk fails to record the and address of the last module
+                      loaded. Guesstimate it from the line numbers instead. */
+ 
+ 		  if( capping_text == 0 ) capping_text = sline_highval;
+ #endif /*ULTRIX_LK */
+ 
  		  end_psymtab (pst, psymtab_include_list, includes_used,
  			       symnum * sizeof (struct nlist), capping_text,
  			       dependency_list, dependencies_used,
***************
*** 2116,2122
  	      if (past_first_source_file && pst)
  		{
  		  end_psymtab (pst, psymtab_include_list, includes_used,
! 			       symnum * sizeof (struct nlist), bufp->n_value,
  			       dependency_list, dependencies_used,
  			       global_psymbols.next, static_psymbols.next);
  		  pst = (struct partial_symtab *) 0;

--- 2137,2143 -----
  #endif /*ULTRIX_LK */
  
  		  end_psymtab (pst, psymtab_include_list, includes_used,
! 			       symnum * sizeof (struct nlist), capping_text,
  			       dependency_list, dependencies_used,
  			       global_psymbols.next, static_psymbols.next);
  		  pst = (struct partial_symtab *) 0;