Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: [robertl@sco.com: threads RH6/Sparc vs. GDB]
       [not found]     ` <199911011742.MAA28800@devserv.devel.redhat.com>
@ 1999-11-01 11:10       ` Scott Bambrough
  1999-11-01 13:08       ` Jakub Jelinek
  1 sibling, 0 replies; 2+ messages in thread
From: Scott Bambrough @ 1999-11-01 11:10 UTC (permalink / raw)
  To: Jim Kingdon; +Cc: robertl, jimb, gdb-patches, davem, jakub

Jim Kingdon wrote:
> 
> > From what I recall, sys/ptrace.h and one of the GDB headers were each
> > trying to outsmart the other.
> 
> No, it is two system headers.  /usr/include/asm-sparc/ptrace.h
> (included via a dizzying cascade of includes from
> /usr/include/signal.h) and /usr/include/sys/ptrace.h.  The former
> contains "#define PTRACE_GETREGS 12" and the latter has an enum which
> contains "PTRACE_GETREGS = 12".
> 

If this include problem is with GLIBC 2.1, then a fix similar to the
following would probably be appropriate.  Problems similar to this have
happened on other platforms.  What really needs to be done is to fix
GLIBC's use of the kernel headers. I submitted patches for the ARM port
a while back to fix similar problems.  See the following posts from
libc-hacker.

http://sourceware.cygnus.com/ml/libc-hacker/1999-01/msg00030.html
http://sourceware.cygnus.com/ml/libc-hacker/1999-09/msg00001.html
http://sourceware.cygnus.com/ml/libc-hacker/1998-05/msg00277.html

Just a suggestion.

Scott
-- 
Scott Bambrough - Software Engineer
REBEL.COM    http://www.rebel.com
NetWinder    http://www.netwinder.org
From guo@cup.hp.com Mon Nov 01 11:34:00 1999
From: Jimmy Guo <guo@cup.hp.com>
To: gdb-patches@sourceware.cygnus.com
Subject: 2nd try: (patch) hpjyg03: (buildsym|language).[ch]
Date: Mon, 01 Nov 1999 11:34:00 -0000
Message-id: <Pine.LNX.4.10.9911011130300.30664-100000@hpcll168.cup.hp.com>
References: <Pine.LNX.4.10.9911010939010.16929-100000@hpcll168.cup.hp.com>
X-SW-Source: 1999-q4/msg00136.html
Content-length: 11762

Revision of patch hpjyg03:
  Use buildsym.c:add_free_pendings() to manage addition to free_pendings; 
  Yanked out subfiles change to end_symtab() in the original patch
  submission.

- Jimmy Guo

Index: gdb/ChangeLog
/opt/gnu/bin/diff -r -c -N  /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/ChangeLog gdb/ChangeLog
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/ChangeLog	Thu Oct 28 17:32:08 1999
--- gdb/ChangeLog	Mon Nov  1 11:22:55 1999
***************
*** 1,3 ****
--- 1,16 ----
+ 1999-11-01	Jimmy Guo	<guo@cup.hp.com>
+ 
+ 	* buildsym.h (add_free_pendings): Declare.
+ 
+ 	* buildsym.c (add_free_pendings): New function.
+ 	(make_blockvector): 32x64 fix using longest_local_hex_string().
+ 	(start_subfile): initialize variable 'subfile'.
+ 	* language.h (longest_raw_hex_string, longest_local_hex_string,
+ 	longest_local_hex_string_custom): Declare.
+ 	* language.c: New functions, and misc. fixes.
+ 	(longest_raw_hex_string, longest_local_hex_string,
+ 	longest_local_hex_string_custom): New functions.
+ 
  1999-10-28	Jimmy Guo	<guo@cup.hp.com>
  
  	* annotate.c (breakpoints_changed,annotate_ignore_count_change,
Index: gdb/buildsym.h
/opt/gnu/bin/diff -r -c -N  /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/buildsym.h gdb/buildsym.h
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/buildsym.h	Mon Nov  1 10:41:21 1999
--- gdb/buildsym.h	Mon Nov  1 10:42:37 1999
***************
*** 231,236 ****
--- 231,238 ----
  
  #define	INITIAL_TYPE_VECTOR_LENGTH	160
  
+ extern void add_free_pendings (struct pending *list);
+ 
  extern void add_symbol_to_list (struct symbol *symbol,
  				struct pending **listhead);
  
Index: gdb/buildsym.c
/opt/gnu/bin/diff -r -c -N  /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/buildsym.c gdb/buildsym.c
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/buildsym.c	Thu Oct 28 17:47:29 1999
--- gdb/buildsym.c	Mon Nov  1 10:55:17 1999
***************
*** 81,90 ****
  {"inner block (0x%lx-0x%lx) not inside outer block (0x%lx-0x%lx)", 0, 0};
  
  struct complaint blockvector_complaint =
! {"block at 0x%lx out of order", 0, 0};
  \f
  /* maintain the lists of symbols and blocks */
  
  /* Add a symbol to one of the lists of symbols.  */
  
  void
--- 81,104 ----
  {"inner block (0x%lx-0x%lx) not inside outer block (0x%lx-0x%lx)", 0, 0};
  
  struct complaint blockvector_complaint =
! {"block at %s out of order", 0, 0};
  \f
  /* maintain the lists of symbols and blocks */
  
+ /* Add a pending list to free_pendings. */
+ void
+ add_free_pendings (struct pending *list)
+ {
+   register struct pending *link = list;
+ 
+   if (list)
+     {
+       while (link->next) link = link->next;
+       link->next = free_pendings;
+       free_pendings = list;
+     }
+ }
+       
  /* Add a symbol to one of the lists of symbols.  */
  
  void
***************
*** 487,503 ****
  	  if (BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i - 1))
  	      > BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i)))
  	    {
- 
- 	      /* FIXME-32x64: loses if CORE_ADDR doesn't fit in a
- 	         long.  Possible solutions include a version of
- 	         complain which takes a callback, a
- 	         sprintf_address_numeric to match
- 	         print_address_numeric, or a way to set up a GDB_FILE
- 	         which causes sprintf rather than fprintf to be
- 	         called.  */
- 
  	      complain (&blockvector_complaint,
! 			(unsigned long) BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i)));
  	    }
  	}
      }
--- 501,510 ----
  	  if (BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i - 1))
  	      > BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i)))
  	    {
  	      complain (&blockvector_complaint,
! 			longest_local_hex_string (
! 						   (LONGEST) BLOCK_START (
! 				      BLOCKVECTOR_BLOCK (blockvector, i))));
  	    }
  	}
      }
***************
*** 533,538 ****
--- 540,546 ----
       source file.  */
  
    subfile = (struct subfile *) xmalloc (sizeof (struct subfile));
+   memset ((char *) subfile, 0, sizeof (struct subfile));
    subfile->next = subfiles;
    subfiles = subfile;
    current_subfile = subfile;
Index: gdb/language.h
/opt/gnu/bin/diff -r -c -N -L gdb/language.h gdb/language.h@@/GDB_1999_10_25 gdb/language.h
*** gdb/language.h
--- gdb/language.h	Fri Oct 29 15:20:35 1999
***************
*** 360,374 ****
  extern char *
    local_hex_format_custom PARAMS ((char *));	/* language.c */
  
  /* Return a string that contains a number formatted in one of the local
     (language-specific) formats.  Result is static and is overwritten by
!    the next call.  Takes printf options like "08" or "l".  */
  
  extern char *
    local_hex_string PARAMS ((unsigned long));	/* language.c */
  
  extern char *
    local_hex_string_custom PARAMS ((unsigned long, char *));	/* language.c */
  
  /* Type predicates */
  
--- 360,386 ----
  extern char *
    local_hex_format_custom PARAMS ((char *));	/* language.c */
  
+ /* Return a string that contains the hex digits of the number.  No preceeding
+    "0x" */
+ 
+ extern char *
+   longest_raw_hex_string PARAMS ((LONGEST));
+ 
  /* Return a string that contains a number formatted in one of the local
     (language-specific) formats.  Result is static and is overwritten by
!    the next call.  Takes printf options like "08l" or "l".  */
  
  extern char *
    local_hex_string PARAMS ((unsigned long));	/* language.c */
  
  extern char *
+   longest_local_hex_string PARAMS ((LONGEST));	/* language.c */
+ 
+ extern char *
    local_hex_string_custom PARAMS ((unsigned long, char *));	/* language.c */
+ 
+ extern char *
+   longest_local_hex_string_custom PARAMS ((LONGEST, char *));	/* language.c */
  
  /* Type predicates */
  
Index: gdb/language.c
/opt/gnu/bin/diff -r -c -N -L gdb/language.c gdb/language.c@@/GDB_1999_10_25 gdb/language.c
*** gdb/language.c
--- gdb/language.c	Thu Oct 28 18:17:17 1999
***************
*** 28,33 ****
--- 28,34 ----
     return data out of a "language-specific" struct pointer that is set
     whenever the working language changes.  That would be a lot faster.  */
  
+ #include <assert.h>
  #include "defs.h"
  #include <ctype.h>
  #include "gdb_string.h"
***************
*** 288,293 ****
--- 289,298 ----
           did it in set_type_range. */
        return;
      }
+   else
+     {
+       warning ("Unrecognized type check setting: \"%s\"", type);
+     }
    set_type_str ();
    show_type_command ((char *) NULL, from_tty);
  }
***************
*** 334,339 ****
--- 339,348 ----
           did it in set_type_range. */
        return;
      }
+   else
+     {
+       warning ("Unrecognized range check setting: \"%s\"", range);
+     }
    set_range_str ();
    show_range_command ((char *) 0, from_tty);
  }
***************
*** 398,404 ****
  static void
  set_type_str ()
  {
!   char *tmp, *prefix = "";
  
    free (type);
    if (type_mode == type_mode_auto)
--- 407,413 ----
  static void
  set_type_str ()
  {
!   char *tmp = NULL, *prefix = "";
  
    free (type);
    if (type_mode == type_mode_auto)
***************
*** 427,433 ****
  {
    char *tmp, *pref = "";
  
-   free (range);
    if (range_mode == range_mode_auto)
      pref = "auto; currently ";
  
--- 436,441 ----
***************
*** 446,451 ****
--- 454,460 ----
        error ("Unrecognized range check setting.");
      }
  
+   free (range);
    range = concat (pref, tmp, NULL);
  }
  
***************
*** 539,544 ****
--- 548,571 ----
    return form;
  }
  
+ /* Converts a number to hexadecimal (without leading "0x") and stores it in a
+    static string.  Returns a pointer to this string. */
+ 
+ char *
+ longest_raw_hex_string (num)
+      LONGEST num;
+ {
+   static char res_longest_raw_hex_string[50];
+   long long ll = num;		/* MERGEBUG ?? see below */
+   res_longest_raw_hex_string[0] = 0;
+   /* MERGEBUG ?? As a quick fix I am replacing this with sprintf 
+      strcat_address_numeric (num, 0, res_longest_raw_hex_string, 50); 
+    */
+ 
+   sprintf (res_longest_raw_hex_string, "%llx", ll);
+   return res_longest_raw_hex_string;
+ }
+ 
  /* Converts a number to hexadecimal and stores it in a static
     string.  Returns a pointer to this string. */
  char *
***************
*** 551,556 ****
--- 578,592 ----
    return res;
  }
  
+ /* Converts a LONGEST number to hexadecimal and stores it in a static
+    string.  Returns a pointer to this string. */
+ char *
+ longest_local_hex_string (num)
+      LONGEST num;
+ {
+   return longest_local_hex_string_custom (num, "l");
+ }
+ 
  /* Converts a number to custom hexadecimal and stores it in a static
     string.  Returns a pointer to this string. */
  char *
***************
*** 563,568 ****
--- 599,702 ----
    sprintf (res, local_hex_format_custom (pre), num);
    return res;
  }
+ 
+ /* Converts a LONGEST number to custom hexadecimal and stores it in a static
+    string.  Returns a pointer to this string. Note that the width parameter
+    should end with "l", e.g. "08l" as with calls to local_hex_string_custom */
+ 
+ char *
+ longest_local_hex_string_custom (num, width)
+      LONGEST num;
+      char *width;
+ {
+ #define RESULT_BUF_LEN 50
+   static char res2[RESULT_BUF_LEN];
+   char format[RESULT_BUF_LEN];
+ #if !defined (PRINTF_HAS_LONG_LONG)
+   int field_width;
+   int num_len;
+   int num_pad_chars;
+   char *pad_char;		/* string with one character */
+   int pad_on_left;
+   char *parse_ptr;
+   char temp_nbr_buf[RESULT_BUF_LEN];
+ #endif
+ 
+ #ifndef CC_HAS_LONG_LONG
+   /* If there is no long long, then LONGEST should be just long and we
+      can use local_hex_string_custom 
+    */
+   return local_hex_string_custom ((unsigned long) num, width);
+ #endif
+ 
+ #if defined (PRINTF_HAS_LONG_LONG)
+   /* Just use printf.  */
+   strcpy (format, local_hex_format_prefix ());	/* 0x */
+   strcat (format, "%");
+   strcat (format, width);	/* e.g. "08l" */
+   strcat (format, "l");		/* need "ll" for long long */
+   strcat (format, local_hex_format_specifier ());	/* "x" */
+   strcat (format, local_hex_format_suffix ());	/* "" */
+   sprintf (res2, format, num);
+   return res2;
+ #else /* !defined (PRINTF_HAS_LONG_LONG) */
+   /* Use strcat_address_numeric to print the number into a string, then
+      build the result string from local_hex_format_prefix, padding and 
+      the hex representation as indicated by "width".  */
+ 
+   temp_nbr_buf[0] = 0;
+   /* With use_local == 0, we don't get the leading "0x" prefix. */
+   /* MERGEBUG ?? As a quick fix I am replacing this call to
+      strcat_address_numeric with sprintf
+      strcat_address_numeric(num, 0, temp_nbr_buf, RESULT_BUF_LEN);
+    */
+ 
+   {
+     long long ll = num;
+     sprintf (temp_nbr_buf, "%llx", ll);
+   }
+   /* parse width */
+   parse_ptr = width;
+   pad_on_left = 1;
+   pad_char = " ";
+   if (*parse_ptr == '-')
+     {
+       parse_ptr++;
+       pad_on_left = 0;
+     }
+   if (*parse_ptr == '0')
+     {
+       parse_ptr++;
+       if (pad_on_left)
+ 	pad_char = "0";		/* If padding is on the right, it is blank */
+     }
+   field_width = atoi (parse_ptr);
+   num_len = strlen (temp_nbr_buf);
+   num_pad_chars = field_width - strlen (temp_nbr_buf);	/* possibly negative */
+   assert (strlen (local_hex_format_prefix ()) + num_len + num_pad_chars
+ 	  < RESULT_BUF_LEN);
+   strcpy (res2, local_hex_format_prefix ());
+   if (pad_on_left)
+     {
+       while (num_pad_chars > 0)
+ 	{
+ 	  strcat (res2, pad_char);
+ 	  num_pad_chars--;
+ 	}
+     }
+   strcat (res2, temp_nbr_buf);
+   if (!pad_on_left)
+     {
+       while (num_pad_chars > 0)
+ 	{
+ 	  strcat (res2, pad_char);
+ 	  num_pad_chars--;
+ 	}
+     }
+   return res2;
+ #endif
+ 
+ }				/* longest_local_hex_string_custom */
  
  /* Returns the appropriate printf format for octal
     numbers. */


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [robertl@sco.com: threads RH6/Sparc vs. GDB]
       [not found]     ` <199911011742.MAA28800@devserv.devel.redhat.com>
  1999-11-01 11:10       ` [robertl@sco.com: threads RH6/Sparc vs. GDB] Scott Bambrough
@ 1999-11-01 13:08       ` Jakub Jelinek
  1 sibling, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 1999-11-01 13:08 UTC (permalink / raw)
  To: Jim Kingdon; +Cc: robertl, jimb, gdb-patches, davem

On Mon, Nov 01, 1999 at 12:42:23PM -0500, Jim Kingdon wrote:
> > From what I recall, sys/ptrace.h and one of the GDB headers were each
> > trying to outsmart the other.
> 
> No, it is two system headers.  /usr/include/asm-sparc/ptrace.h
> (included via a dizzying cascade of includes from
> /usr/include/signal.h) and /usr/include/sys/ptrace.h.  The former
> contains "#define PTRACE_GETREGS 12" and the latter has an enum which
> contains "PTRACE_GETREGS = 12".
> 
> DaveM, Jakub, let's get this fixed.  We've been kludging around it in
> GDB long enough.

I hope this is already fixed, at least I hacked on it. But it is in 2.3.*
kernel headers and glibc 2.1.90 CVS, but I can backport it if needed.

Cheers,
    Jakub
___________________________________________________________________
Jakub Jelinek | jakub@redhat.com | http://sunsite.mff.cuni.cz/~jj
Linux version 2.3.18 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________
From shebs@cygnus.com Mon Nov 01 13:27:00 1999
From: Stan Shebs <shebs@cygnus.com>
To: tromey@cygnus.com
Cc: tromey@cygnus.com, gdb-patches@sourceware.cygnus.com
Subject: Re: Patch: --enable-profiling
Date: Mon, 01 Nov 1999 13:27:00 -0000
Message-id: <199911012127.NAA17713@andros.cygnus.com>
References: <199910311504.HAA00905@ferrule.cygnus.com>
X-SW-Source: 1999-q4/msg00141.html
Content-length: 1039

   Date: Sun, 31 Oct 1999 07:04:57 -0800 (PST)
   From: Tom Tromey <tromey@cygnus.com>

   Stan> BTW, will this work with djgpp and/or cygwin?  What will happen
   Stan> if you try to configure on those with --enabling-profiling?

   It might work or it might not.  I don't know.  My theory is that
   profiling gdb is a maintainer thing, and if somebody uses
   --enable-profiling and it doesn't build, they had better know what
   they are doing anyway.  We can always add tests for functions later.
   I could add them now if it is important; it is easy enough to do.
   Ordinarily I'm zealous about portability, but in this case I don't
   think it matters that much.

If it's not going to work, or as cgf suggests, it won't be very
interesting, it's worth just having a note in the docs to that effect.
Internals manual only is sufficient.  Even a knowledgeable person,
using this for the first time, will be hard-pressed to know whether
the failure to build/run is a known limitation, or something wrong in
the setup.

								Stan


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-11-01 13:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <199911010048.TAA07679@devserv.devel.redhat.com>
     [not found] ` <npg0yqkzes.fsf@zwingli.cygnus.com>
     [not found]   ` <19991101110509.O19769@rjlhome.sco.com>
     [not found]     ` <199911011742.MAA28800@devserv.devel.redhat.com>
1999-11-01 11:10       ` [robertl@sco.com: threads RH6/Sparc vs. GDB] Scott Bambrough
1999-11-01 13:08       ` Jakub Jelinek

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