This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
2nd try: (patch) hpjyg03: (buildsym|language).[ch]
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: 2nd try: (patch) hpjyg03: (buildsym|language).[ch]
- From: Jimmy Guo <guo at cup dot hp dot com>
- Date: Mon, 1 Nov 1999 11:33:58 -0800 (PST)
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};
/* 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};
/* 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. */