This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
(patch) hpjyg03: (buildsym|language).[ch]
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: (patch) hpjyg03: (buildsym|language).[ch]
- From: Jimmy Guo <guo at cup dot hp dot com>
- Date: Fri, 29 Oct 1999 15:40:07 -0700 (PDT)
A small patch to buildsym.c / language.c w/ bug fixes and addition of
longest_raw_hex_string, longest_local_hex_string(_custom) routines to
handle 32x64 printing problem.
free_pendings is made global, and I will submit a patch within a week to
make use of this change.
- Jimmy Guo, guo@cup.hp.com
Index: gdb/ChangeLog
/opt/gnu/bin/diff -r -c -N -L gdb/ChangeLog gdb/ChangeLog@@/GDB_1999_10_25 gdb/ChangeLog
*** gdb/ChangeLog
--- gdb/ChangeLog Fri Oct 29 15:34:29 1999
***************
*** 1,3 ****
--- 1,28 ----
+ 1999-10-29 Jimmy Guo <guo@cup.hp.com>
+
+ * buildsym.h (free_pendings): Declare.
+
+ * buildsym.c: Make free_pendings global, and misc. fixes.
+ (make_blockvector): 32x64 fix using longest_local_hex_string().
+ (start_subfile): initialize variable 'subfile'.
+ (end_symtab): fix bug freeing 'subfiles' list element, when it's
+ the list head to be freed.
+ * 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,
+ annotate_stopped): Provide annotation for breakpoint
+ ignore_count changes but only provide once at annotate_stopped
+ time for sucessive ignore_count triggered breakpoint changes, to
+ make the GUI happy yet lazy.
+ * breakpoint.c (bpstat_stop_status): call
+ annotate_ignore_count_change when ignore_count changes.
+
Mon Oct 25 18:22:06 1999 Andrew Cagney <cagney@b1.cygnus.com>
* remote.c: Document future of compare_sections_command.
Index: gdb/buildsym.h
/opt/gnu/bin/diff -r -c -N -L gdb/buildsym.h gdb/buildsym.h@@/GDB_1999_10_25 gdb/buildsym.h
*** gdb/buildsym.h
--- gdb/buildsym.h Thu Oct 28 18:11:31 1999
***************
*** 109,114 ****
--- 109,118 ----
struct symbol *symbol[PENDINGSIZE];
};
+ /* List of free `struct pending' structures for reuse. */
+
+ EXTERN struct pending *free_pendings;
+
/* Here are the three lists that symbols are put on. */
/* static at top level, and types */
Index: gdb/buildsym.c
/opt/gnu/bin/diff -r -c -N -L gdb/buildsym.c gdb/buildsym.c@@/GDB_1999_10_25 gdb/buildsym.c
*** gdb/buildsym.c
--- gdb/buildsym.c Thu Oct 28 18:17:15 1999
***************
*** 46,54 ****
#include "stabsread.h"
! /* List of free `struct pending' structures for reuse. */
!
! static struct pending *free_pendings;
/* Non-zero if symtab has line number info. This prevents an
otherwise empty symtab from being tossed. */
--- 46,53 ----
#include "stabsread.h"
! /* From language.h */
! extern char *longest_local_hex_string PARAMS ((LONGEST num));
/* Non-zero if symtab has line number info. This prevents an
otherwise empty symtab from being tossed. */
***************
*** 81,87 ****
{"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};
/* maintain the lists of symbols and blocks */
--- 80,86 ----
{"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};
/* maintain the lists of symbols and blocks */
***************
*** 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)));
}
}
}
--- 486,495 ----
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 ****
--- 525,531 ----
source file. */
subfile = (struct subfile *) xmalloc (sizeof (struct subfile));
+ memset ((char *) subfile, 0, sizeof (struct subfile));
subfile->next = subfiles;
subfiles = subfile;
current_subfile = subfile;
***************
*** 998,1003 ****
--- 991,998 ----
}
nextsub = subfile->next;
+ if (subfiles == subfile)
+ subfiles = nextsub;
free ((void *) 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. */