aboutsummaryrefslogtreecommitdiff
path: root/gdb/stabsread.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/stabsread.c')
-rw-r--r--gdb/stabsread.c155
1 files changed, 79 insertions, 76 deletions
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index c5d31e1..a143dba 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -196,9 +196,12 @@ static const char vb_name[] = { '_','v','b',CPLUS_MARKER,'\0' };
address of the corresponding int, which is not the same on a
big-endian machine. */
-#ifndef BELIEVE_PCC_PROMOTION
+#if !defined (BELIEVE_PCC_PROMOTION)
#define BELIEVE_PCC_PROMOTION 0
#endif
+#if !defined (BELIEVE_PCC_PROMOTION_TYPE)
+#define BELIEVE_PCC_PROMOTION_TYPE 0
+#endif
static struct complaint invalid_cpp_abbrev_complaint =
{"invalid C++ abbreviation `%s'", 0, 0};
@@ -1732,80 +1735,80 @@ define_symbol (valu, string, desc, type, objfile)
if (processing_gcc_compilation || BELIEVE_PCC_PROMOTION)
break;
-#if !BELIEVE_PCC_PROMOTION
- {
- /* This is the signed type which arguments get promoted to. */
- static struct type *pcc_promotion_type;
- /* This is the unsigned type which arguments get promoted to. */
- static struct type *pcc_unsigned_promotion_type;
-
- /* Call it "int" because this is mainly C lossage. */
- if (pcc_promotion_type == NULL)
- pcc_promotion_type =
- init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
- 0, "int", NULL);
-
- if (pcc_unsigned_promotion_type == NULL)
- pcc_unsigned_promotion_type =
- init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED, "unsigned int", NULL);
-
-#if defined(BELIEVE_PCC_PROMOTION_TYPE)
- /* This macro is defined on machines (e.g. sparc) where
- we should believe the type of a PCC 'short' argument,
- but shouldn't believe the address (the address is
- the address of the corresponding int).
-
- My guess is that this correction, as opposed to changing
- the parameter to an 'int' (as done below, for PCC
- on most machines), is the right thing to do
- on all machines, but I don't want to risk breaking
- something that already works. On most PCC machines,
- the sparc problem doesn't come up because the calling
- function has to zero the top bytes (not knowing whether
- the called function wants an int or a short), so there
- is little practical difference between an int and a short
- (except perhaps what happens when the GDB user types
- "print short_arg = 0x10000;").
-
- Hacked for SunOS 4.1 by gnu@cygnus.com. In 4.1, the compiler
- actually produces the correct address (we don't need to fix it
- up). I made this code adapt so that it will offset the symbol
- if it was pointing at an int-aligned location and not
- otherwise. This way you can use the same gdb for 4.0.x and
- 4.1 systems.
-
- If the parameter is shorter than an int, and is integral
- (e.g. char, short, or unsigned equivalent), and is claimed to
- be passed on an integer boundary, don't believe it! Offset the
- parameter's address to the tail-end of that integer. */
-
- if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (pcc_promotion_type)
- && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT
- && 0 == SYMBOL_VALUE (sym) % TYPE_LENGTH (pcc_promotion_type))
- {
- SYMBOL_VALUE (sym) += TYPE_LENGTH (pcc_promotion_type)
- - TYPE_LENGTH (SYMBOL_TYPE (sym));
- }
- break;
-
-#else /* no BELIEVE_PCC_PROMOTION_TYPE. */
-
- /* If PCC says a parameter is a short or a char,
- it is really an int. */
- if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (pcc_promotion_type)
- && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT)
- {
- SYMBOL_TYPE (sym) =
- TYPE_UNSIGNED (SYMBOL_TYPE (sym))
- ? pcc_unsigned_promotion_type
- : pcc_promotion_type;
- }
- break;
-
-#endif /* no BELIEVE_PCC_PROMOTION_TYPE. */
- }
-#endif /* !BELIEVE_PCC_PROMOTION. */
+ if (!BELIEVE_PCC_PROMOTION)
+ {
+ /* This is the signed type which arguments get promoted to. */
+ static struct type *pcc_promotion_type;
+ /* This is the unsigned type which arguments get promoted to. */
+ static struct type *pcc_unsigned_promotion_type;
+
+ /* Call it "int" because this is mainly C lossage. */
+ if (pcc_promotion_type == NULL)
+ pcc_promotion_type =
+ init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
+ 0, "int", NULL);
+
+ if (pcc_unsigned_promotion_type == NULL)
+ pcc_unsigned_promotion_type =
+ init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED, "unsigned int", NULL);
+
+ if (BELIEVE_PCC_PROMOTION_TYPE)
+ {
+ /* This is defined on machines (e.g. sparc) where we
+ should believe the type of a PCC 'short' argument,
+ but shouldn't believe the address (the address is the
+ address of the corresponding int).
+
+ My guess is that this correction, as opposed to
+ changing the parameter to an 'int' (as done below,
+ for PCC on most machines), is the right thing to do
+ on all machines, but I don't want to risk breaking
+ something that already works. On most PCC machines,
+ the sparc problem doesn't come up because the calling
+ function has to zero the top bytes (not knowing
+ whether the called function wants an int or a short),
+ so there is little practical difference between an
+ int and a short (except perhaps what happens when the
+ GDB user types "print short_arg = 0x10000;").
+
+ Hacked for SunOS 4.1 by gnu@cygnus.com. In 4.1, the
+ compiler actually produces the correct address (we
+ don't need to fix it up). I made this code adapt so
+ that it will offset the symbol if it was pointing at
+ an int-aligned location and not otherwise. This way
+ you can use the same gdb for 4.0.x and 4.1 systems.
+
+ If the parameter is shorter than an int, and is
+ integral (e.g. char, short, or unsigned equivalent),
+ and is claimed to be passed on an integer boundary,
+ don't believe it! Offset the parameter's address to
+ the tail-end of that integer. */
+
+ if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (pcc_promotion_type)
+ && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT
+ && 0 == SYMBOL_VALUE (sym) % TYPE_LENGTH (pcc_promotion_type))
+ {
+ SYMBOL_VALUE (sym) += TYPE_LENGTH (pcc_promotion_type)
+ - TYPE_LENGTH (SYMBOL_TYPE (sym));
+ }
+ break;
+ }
+ else
+ {
+ /* If PCC says a parameter is a short or a char,
+ it is really an int. */
+ if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (pcc_promotion_type)
+ && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT)
+ {
+ SYMBOL_TYPE (sym) =
+ TYPE_UNSIGNED (SYMBOL_TYPE (sym))
+ ? pcc_unsigned_promotion_type
+ : pcc_promotion_type;
+ }
+ break;
+ }
+ }
case 'P':
/* acc seems to use P to declare the prototypes of functions that
@@ -2147,7 +2150,7 @@ define_symbol (valu, string, desc, type, objfile)
while (*p && *p == ';')
{
p++;
- if (*p && *p == 'l')
+ if (*p && p[0] == 'l' && p[1] == '(')
{
/* GNU extensions for live range splitting may be appended to
the end of the stab string. eg. "l(#1,#2);l(#3,#5)" */