Changeset 722


Ignore:
Timestamp:
Sep 24, 2003, 8:47:07 PM (22 years ago)
Author:
bird
Message:

#456: Dirty hack for making debug info for global variables.
#456: took dbxout_class_name_qualifiers from 3.3.1, not sure if it's a good idea yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gcc/gcc/dbxout.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r721 r722  
    310310static void print_wide_int              PARAMS ((HOST_WIDE_INT));
    311311static void dbxout_type_name            PARAMS ((tree));
     312static void dbxout_class_name_qualifiers PARAMS ((tree)); /* bird: from 3.3.1 */
    312313static int dbxout_symbol_location       PARAMS ((tree, tree, const char *, rtx));
    313314static void dbxout_symbol_name          PARAMS ((tree, const char *, int));
     
    674675{
    675676  if (TREE_CODE (decl) == VAR_DECL
     677#ifdef EMX /* bird: debug info for all referenced global vars. */
     678      && (   !DECL_EXTERNAL (decl)
     679          || (   use_gnu_debug_info_extensions
     680              && TREE_SYMBOL_REFERENCED (DECL_NAME (decl))))
     681#else
    676682      && ! DECL_EXTERNAL (decl)
     683#endif
    677684      && DECL_RTL_SET_P (decl)) /* Not necessary?  */
    678685    dbxout_symbol (decl, 0);
    679 } 
     686}
    680687
    681688/* At the end of compilation, finish writing the symbol table.
     
    18681875  CHARS (digs);
    18691876}
    1870      
     1877
    18711878/* Output the name of type TYPE, with no punctuation.
    18721879   Such names can be set up either by typedef declarations
     
    18931900  fprintf (asmfile, "%s", IDENTIFIER_POINTER (t));
    18941901  CHARS (IDENTIFIER_LENGTH (t));
     1902}
     1903
     1904/* bird: from 3.3.1: */
     1905/* Output leading leading struct or class names needed for qualifying
     1906   type whose scope is limited to a struct or class.  */
     1907
     1908static void
     1909dbxout_class_name_qualifiers (decl)
     1910     tree decl;
     1911{
     1912  tree context = decl_type_context (decl);
     1913
     1914  if (context != NULL_TREE
     1915      && TREE_CODE(context) == RECORD_TYPE
     1916      && TYPE_NAME (context) != 0
     1917      && (TREE_CODE (TYPE_NAME (context)) == IDENTIFIER_NODE
     1918          || (DECL_NAME (TYPE_NAME (context)) != 0)))
     1919    {
     1920      tree name = TYPE_NAME (context);
     1921
     1922      if (TREE_CODE (name) == TYPE_DECL)
     1923        {
     1924          dbxout_class_name_qualifiers (name);
     1925          name = DECL_NAME (name);
     1926        }
     1927      fprintf (asmfile, "%s::", IDENTIFIER_POINTER (name));
     1928      CHARS (IDENTIFIER_LENGTH (name) + 2);
     1929    }
    18951930}
    18961931
     
    20362071              }
    20372072
     2073#if 1  /* bird: from 3.3.1 */
     2074            /* Output .stabs (or whatever) and leading double quote.  */
     2075            fprintf (asmfile, "%s\"", ASM_STABS_OP);
     2076
     2077            if (use_gnu_debug_info_extensions)
     2078              {
     2079                /* Output leading class/struct qualifiers.  */
     2080                dbxout_class_name_qualifiers (decl);
     2081              }
     2082
    20382083            /* Output typedef name.  */
     2084            fprintf (asmfile, "%s:", IDENTIFIER_POINTER (DECL_NAME (decl)));
     2085#else
     2086            /* Output typedef name.  */
    20392087            fprintf (asmfile, "%s\"%s:", ASM_STABS_OP,
    20402088                     IDENTIFIER_POINTER (DECL_NAME (decl)));
     2089#endif
    20412090
    20422091            /* Short cut way to output a tag also.  */
     
    21302179      if (! DECL_RTL_SET_P (decl))
    21312180        return 0;
     2181#ifdef EMX
     2182      /* Don't mention a variable that is external and unreferenced..
     2183         bird: Referenced variables must be mentioned for OMF support.  */
     2184      if (DECL_EXTERNAL (decl)
     2185          && (   !use_gnu_debug_info_extensions
     2186              || !TREE_SYMBOL_REFERENCED (DECL_NAME (decl))))
     2187        break;
     2188#else
    21322189      /* Don't mention a variable that is external.
    21332190         Let the file that defines it describe it.  */
    21342191      if (DECL_EXTERNAL (decl))
    21352192        break;
     2193#endif
    21362194
    21372195      /* If the variable is really a constant
     
    21802238      result = dbxout_symbol_location (decl, type, 0, DECL_RTL (decl));
    21812239      break;
    2182      
     2240
    21832241    default:
    21842242      break;
     
    22052263  /* Don't mention a variable at all
    22062264     if it was completely optimized into nothingness.
    2207      
     2265
    22082266     If the decl was from an inline function, then its rtl
    22092267     is not identically the rtl that was used in this
     
    22492307          letter = 'G';
    22502308          current_sym_code = N_GSYM;
     2309#ifdef EMX
     2310          /* bird: This is hacks for two things. The first part, to use the
     2311             value of a 'G', is intended to help resolving global symbols
     2312             when the variable name isn't equal to the assembler name. f.ex.:
     2313                class foo { foo() {static const char *psz= "foo";} };
     2314             The 2nd hack is for external symbols, which we need debug info for
     2315             on EMX due to HLL conversion. In that case we need to find the
     2316             variable somehow and generates a special alias symbol for it.
     2317             The alias is a pretty unique name which includes the string
     2318             '$hll$' which is what we'll look for. ld accept multiple
     2319             definitions of aliases so it's not really a problem there. The
     2320             value of these 'G' stabs are always -12357.  */
     2321          if (use_gnu_debug_info_extensions)
     2322            {
     2323              current_sym_addr = XEXP (home, 0);
     2324              if (DECL_EXTERNAL (decl))
     2325                {
     2326                  struct timeval tv;
     2327                  /* We'll make a special alias for the external symbol
     2328                     which the a.out -> omf copy will detect.
     2329                     Todo: This should really be _after_ the symbol. */
     2330                  dbxout_symbol_name (decl, suffix, letter);
     2331                  gettimeofday(&tv, NULL);
     2332                  fprintf (asmfile, "$hll$%lx%08lx\",%d,0,0,0\n",
     2333                           tv.tv_sec, tv.tv_usec, /*N_INDR | N_EXT*/11);
     2334                  fprintf (asmfile, "\t.stabs\t\"");
     2335                  output_addr_const (asmfile, current_sym_addr);
     2336                  fprintf (asmfile, "\",%d,0,0,0\n", /*N_EXT*/ 1);
     2337                  current_sym_addr = 0;
     2338                  current_sym_value = -12357;
     2339                }
     2340            }
     2341#endif
    22512342        }
    22522343      else
     
    22842375                    current_sym_addr = tmp;
    22852376                }
    2286  
     2377
    22872378              /* Ultrix `as' seems to need this.  */
    22882379#ifdef DBX_STATIC_STAB_DATA_SECTION
     
    25752666
    25762667            /* It is quite tempting to use:
    2577                
     2668       
    25782669                   dbxout_type (TREE_TYPE (parms), 0);
    25792670
     
    27122803                = INTVAL (XEXP (XEXP (XEXP (DECL_RTL (parms), 0), 0), 1));
    27132804            current_sym_addr = 0;
    2714              
     2805            current_sym_code = N_PSYM; /* bird: from 3.3.1 */
     2806       
    27152807            FORCE_TEXT;
    27162808            fprintf (asmfile, "%s\"%s:v", ASM_STABS_OP, decl_name);
     
    27502842                && GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parms))) < UNITS_PER_WORD)
    27512843              {
    2752                 current_sym_value += 
     2844                current_sym_value +=
    27532845                    GET_MODE_SIZE (GET_MODE (DECL_RTL (parms)))
    27542846                    - GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parms)));
     
    28622954
    28632955#if DBX_BLOCKS_FUNCTION_RELATIVE
    2864   const char *begin_label; 
     2956  const char *begin_label;
    28652957  if (current_function_func_begin_label != NULL_TREE)
    28662958    begin_label = IDENTIFIER_POINTER (current_function_func_begin_label);
Note: See TracChangeset for help on using the changeset viewer.