From 0456cbf6658808ffc20bbd2080b7c3bdc555d57d Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Fri, 17 Sep 2004 11:47:19 -0700 Subject: [PATCH] dbxout.c (get_lang_number): New. * dbxout.c (get_lang_number): New. (dbxout_init): Include lang number in N_SO stab. * dbxout.h (N_SO_AS, N_SO_C, N_SO_ANSI_C, N_SO_CC, N_SO_FORTRAN, N_SO_PASCAL, N_SO_FORTRAN90, N_SO_OBJC, N_SO_OBJCPLUS): New #define. testsuite * gcc.dg/20040813-1.c: New test. From-SVN: r87663 --- gcc/ChangeLog | 7 +++++++ gcc/dbxout.c | 29 +++++++++++++++++++++++++++-- gcc/dbxout.h | 11 +++++++++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/20040813-1.c | 14 ++++++++++++++ 5 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/20040813-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2f32b50233d..9b11e42c71c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2004-09-17 Devang Patel + + * dbxout.c (get_lang_number): New. + (dbxout_init): Include lang number in N_SO stab. + * dbxout.h (N_SO_AS, N_SO_C, N_SO_ANSI_C, N_SO_CC, N_SO_FORTRAN, + N_SO_PASCAL, N_SO_FORTRAN90, N_SO_OBJC, N_SO_OBJCPLUS): New #define. + 2004-09-17 Diego Novillo PR tree-optimization/17273 diff --git a/gcc/dbxout.c b/gcc/dbxout.c index 9527c1de26d..452a62d8cb7 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -343,6 +343,7 @@ static void emit_pending_bincls (void); static inline void emit_pending_bincls_if_required (void); static void dbxout_init (const char *); +static unsigned int get_lang_number (void); static void dbxout_finish (const char *); static void dbxout_start_source_file (unsigned, const char *); static void dbxout_end_source_file (unsigned); @@ -489,6 +490,30 @@ dbxout_function_end (void) } #endif /* DBX_DEBUGGING_INFO */ +/* Get lang description for N_SO stab. */ + +static unsigned int +get_lang_number (void) +{ + const char *language_string = lang_hooks.name; + + if (strcmp (language_string, "GNU C") == 0) + return N_SO_C; + else if (strcmp (language_string, "GNU C++") == 0) + return N_SO_CC; + else if (strcmp (language_string, "GNU F77") == 0) + return N_SO_FORTRAN; + else if (strcmp (language_string, "GNU F95") == 0) + return N_SO_FORTRAN90; /* CHECKME */ + else if (strcmp (language_string, "GNU Pascal") == 0) + return N_SO_PASCAL; + else if (strcmp (language_string, "GNU Objective-C") == 0) + return N_SO_OBJC; + else + return 0; + +} + /* At the beginning of compilation, start writing the symbol table. Initialize `typevec' and output the standard data types of C. */ @@ -521,7 +546,7 @@ dbxout_init (const char *input_file_name) #else /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */ fprintf (asmfile, "%s", ASM_STABS_OP); output_quoted_string (asmfile, cwd); - fprintf (asmfile, ",%d,0,0,", N_SO); + fprintf (asmfile, ",%d,0,%d,", N_SO, get_lang_number ()); assemble_name (asmfile, ltext_label_name); fputc ('\n', asmfile); #endif /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */ @@ -536,7 +561,7 @@ dbxout_init (const char *input_file_name) /* Used to put `Ltext:' before the reference, but that loses on sun 4. */ fprintf (asmfile, "%s", ASM_STABS_OP); output_quoted_string (asmfile, input_file_name); - fprintf (asmfile, ",%d,0,0,", N_SO); + fprintf (asmfile, ",%d,0,%d,", N_SO, get_lang_number ()); assemble_name (asmfile, ltext_label_name); fputc ('\n', asmfile); text_section (); diff --git a/gcc/dbxout.h b/gcc/dbxout.h index 1d3a2927cea..dcbd01112bf 100644 --- a/gcc/dbxout.h +++ b/gcc/dbxout.h @@ -27,4 +27,15 @@ extern void dbxout_parms (tree); extern void dbxout_reg_parms (tree); extern int dbxout_syms (tree); +/* Language description for N_SO stabs. */ +#define N_SO_AS 1 +#define N_SO_C 2 +#define N_SO_ANSI_C 3 +#define N_SO_CC 4 /* c++*/ +#define N_SO_FORTRAN 5 +#define N_SO_PASCAL 6 +#define N_SO_FORTRAN90 7 +#define N_SO_OBJC 50 +#define N_SO_OBJCPLUS 51 + #endif /* GCC_DBXOUT_H */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1eda48d7e44..db4d92d86da 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-09-17 Devang Patel + + * gcc.dg/20040813-1.c: New test. + 2004-09-17 Diego Novillo PR tree-optimization/17273 diff --git a/gcc/testsuite/gcc.dg/20040813-1.c b/gcc/testsuite/gcc.dg/20040813-1.c new file mode 100644 index 00000000000..c866d4cfeb0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20040813-1.c @@ -0,0 +1,14 @@ +/* Test lang in N_SO stab. */ +/* Contributed by Devang Patel */ + +/* { dg-do compile } */ +/* { dg-options "-gstabs" } */ + +int +main () +{ + return 0; +} + +/* { dg-final { scan-assembler ".stabs*100,0,2" } } */ + -- 2.30.2