Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Zarmfab Software Development <fabsoft@fabsoft2.zarm.uni-bremen.de>
Subject: New Patch for gdb-4.16 on Linux-Alpha ( debugging shared libs )
Date: Fri, 14 Feb 1997 14:20:18 +0100	[thread overview]
Message-ID: <9702141420.ZM9224@fabsoft2.zarm.uni-bremen.de> (raw)

Hi there, last night i hacked a little at gdb  to make
stepping into shared libs possible at my linux-alpha box.

The maintainers of gdb will likely call this an ugly hack. There are still many
Fixme32x64 lines in the source i haven't even looked at - but, it seems to
work for my purposes, what makes me happy.

Besides that, i noticed gdb mostly always didn't display function arguments 
when printing frame infomations, e.g in backtraces or when hitting breakpoints.
Some lines in file stack.c are responsible for this behaviour, which should prevent gdb
from printing wrong frame information in 'certain pathological cases'.
I simply threw them away, maybe that breaks something else. If  you want the original
code that does the (obviously not always appropriate) checks, don't apply the patch to stacks.c.

Compiler used: gcc-2.7.2.1 and binutils 2.7.0.9.

Files used:

the gdb-4.16 source.
binutils 2.7.0.9 source 
the 3 axp-patches contained in the redhat-4.1 gdb-4.16 SRPM
the following patch
glibc-2.01 installed ( maybe it compiles against older Versions, not tried )

options to ./configure:
--prefix=/usr 	( only to be compliant with redhat )

after unpacking the gdb-source, you have to replace the 3 directorys
bfd, include, and opcodes by their counterparts from binutils-2.7.0.9.
First apply the three patches from the redhat-SRPM, then the following
one:

diff -u -r gdb-4.16/gdb/breakpoint.c gdb-4.16-hacked/gdb/breakpoint.c
--- gdb-4.16/gdb/breakpoint.c	Sat Mar 30 06:58:09 1996
+++ gdb-4.16-hacked/gdb/breakpoint.c	Fri Feb 14 12:46:26 1997
@@ -1671,7 +1671,7 @@
             if (addressprint)
               {
                 annotate_field (4);
-                printf_filtered ("Address    ");
+                printf_filtered ("Address            ");
               }
             annotate_field (5);
             printf_filtered ("What\n");
@@ -1691,7 +1691,7 @@
 
 	strcpy (wrap_indent, "                           ");
 	if (addressprint)
-	  strcat (wrap_indent, "           ");
+	  strcat (wrap_indent, "                   ");
 	switch (b->type)
 	  {
 	  case bp_watchpoint:
@@ -1724,7 +1724,7 @@
 		printf_filtered
 		  ("%s ",
 		   local_hex_string_custom
-		   ((unsigned long) b->address, "08l"));
+		   ((unsigned long) b->address, "016l"));
 	      }
 
 	    annotate_field (5);
diff -u -r gdb-4.16/gdb/solib.c gdb-4.16-hacked/gdb/solib.c
--- gdb-4.16/gdb/solib.c	Sat Mar 30 06:58:51 1996
+++ gdb-4.16-hacked/gdb/solib.c	Fri Feb 14 12:40:22 1997
@@ -645,22 +645,21 @@
   /* Find the DT_DEBUG entry in the the .dynamic section.
      For mips elf we look for DT_MIPS_RLD_MAP, mips elf apparently has
      no DT_DEBUG entries.  */
-  /* FIXME: In lack of a 64 bit ELF ABI the following code assumes
-     a 32 bit ELF ABI target.  */
+ 
   for (bufend = buf + dyninfo_sect_size;
        buf < bufend;
-       buf += sizeof (Elf32_External_Dyn))
+       buf += sizeof (Elf64_External_Dyn))
     {
-      Elf32_External_Dyn *x_dynp = (Elf32_External_Dyn *)buf;
+      Elf64_External_Dyn *x_dynp = (Elf64_External_Dyn *)buf;
       long dyn_tag;
       CORE_ADDR dyn_ptr;
 
-      dyn_tag = bfd_h_get_32 (exec_bfd, (bfd_byte *) x_dynp->d_tag);
+      dyn_tag = bfd_h_get_64 (exec_bfd, (bfd_byte *) x_dynp->d_tag);
       if (dyn_tag == DT_NULL)
 	break;
       else if (dyn_tag == DT_DEBUG)
 	{
-	  dyn_ptr = bfd_h_get_32 (exec_bfd, (bfd_byte *) x_dynp->d_un.d_ptr);
+	  dyn_ptr = bfd_h_get_64 (exec_bfd, (bfd_byte *) x_dynp->d_un.d_ptr);
 	  return dyn_ptr;
 	}
 #ifdef DT_MIPS_RLD_MAP
@@ -670,7 +669,7 @@
 
 	  /* DT_MIPS_RLD_MAP contains a pointer to the address
 	     of the dynamic link structure.  */
-	  dyn_ptr = bfd_h_get_32 (exec_bfd, (bfd_byte *) x_dynp->d_un.d_ptr);
+	  dyn_ptr = bfd_h_get_64 (exec_bfd, (bfd_byte *) x_dynp->d_un.d_ptr);
 	  if (target_read_memory (dyn_ptr, pbuf, sizeof (pbuf)))
 	    return 0;
 	  return extract_unsigned_integer (pbuf, sizeof (pbuf));
@@ -941,7 +940,7 @@
     symbol_file_add (so -> so_name, so -> from_tty,
 		     (so->textsection == NULL
 		      ? 0
-		      : (unsigned int) so -> textsection -> addr),
+		      : so -> textsection -> addr),
 		     0, 0, 0);
   return (1);
 }
@@ -1130,18 +1129,18 @@
 	{
 	  if (!header_done)
 	    {
-	      printf_unfiltered("%-12s%-12s%-12s%s\n", "From", "To", "Syms Read",
+	      printf_unfiltered("%-20s%-20s%-12s%s\n", "From", "To", "Syms Read",
 		     "Shared Object Library");
 	      header_done++;
 	    }
 	  /* FIXME-32x64: need print_address_numeric with field width or
 	     some such.  */
-	  printf_unfiltered ("%-12s",
+	  printf_unfiltered ("%-20s",
 		  local_hex_string_custom ((unsigned long) LM_ADDR (so),
-					   "08l"));
-	  printf_unfiltered ("%-12s",
+					   "016l"));
+	  printf_unfiltered ("%-20s",
 		  local_hex_string_custom ((unsigned long) so -> lmend,
-					   "08l"));
+					   "016l"));
 	  printf_unfiltered ("%-12s", so -> symbols_loaded ? "Yes" : "No");
 	  printf_unfiltered ("%s\n",  so -> so_name);
 	}
diff -u -r gdb-4.16/gdb/stack.c gdb-4.16-hacked/gdb/stack.c
--- gdb-4.16/gdb/stack.c	Sat Jan  6 02:58:24 1996
+++ gdb-4.16-hacked/gdb/stack.c	Fri Feb 14 00:11:09 1997
@@ -260,29 +260,9 @@
 	 create a find_pc_minimal_function or some such).  */
 
       struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc);
-      if (msymbol != NULL
-	  && (SYMBOL_VALUE_ADDRESS (msymbol) 
-	      > BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
-	{
-#if 0
-	  /* There is no particular reason to think the line number
-	     information is wrong.  Someone might have just put in
-	     a label with asm() but left the line numbers alone.  */
-	  /* In this case we have no way of knowing the source file
-	     and line number, so don't print them.  */
-	  sal.symtab = 0;
-#endif
-	  /* We also don't know anything about the function besides
-	     its address and name.  */
-	  func = 0;
-	  funname = SYMBOL_NAME (msymbol);
-	  funlang = SYMBOL_LANGUAGE (msymbol);
-	}
-      else
-	{
-	  funname = SYMBOL_NAME (func);
-	  funlang = SYMBOL_LANGUAGE (func);
-	}
+
+      funname = SYMBOL_NAME (func);
+      funlang = SYMBOL_LANGUAGE (func);
     }
   else
     {
diff -u -r gdb-4.16/gdb/utils.c gdb-4.16-hacked/gdb/utils.c
--- gdb-4.16/gdb/utils.c	Tue Apr 23 06:35:13 1996
+++ gdb-4.16-hacked/gdb/utils.c	Wed Feb 12 18:09:10 1997
@@ -772,7 +772,7 @@
 
 PTR
 xmalloc (size)
-     long size;
+     size_t size;
 {
   return (xmmalloc ((PTR) NULL, size));
 }
@@ -782,7 +782,7 @@
 PTR
 xrealloc (ptr, size)
      PTR ptr;
-     long size;
+     size_t size;
 {
   return (xmrealloc ((PTR) NULL, ptr, size));
 }

-- 
Martin Cornelius, ZARMFAB software development, University of Bremen
phone: 49-421-218-4807    FAX: 49-421-218-3889
email: fabsoft@zarm.uni-bremen.de
paper-mail: Hochschulring / Am Fallturm, 28359 BREMEN, Germany

--
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

                 reply	other threads:[~1997-02-14 13:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

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