This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

print_symbol_info patch for source code not current language



   Using my pascal patched GDB 
with a executable that links both C and pascal code I noticed that
  all the functions where printed out using the current language,
even if in automatic mode !!
  C functions printed out in pascal conventions are really uggly !!
(And I don't say that because I prefer C,
remember that I am a codevelopper of Free Pascal
and that I started coding C just to be able to patch GDB !)

  Shouldn't we use the language of source if known at least if
the current language mode is auto ??

  This short patch to symtab.c solve this problem
 
Notes :
  - diff is relative to 4.18 version
  - I don't know if  SYMBOL_LANGUAGE(sym) can be auto ?
this seems unlikely to me but I still added the code 

*** ../gdbori/symtab.c	Thu Feb 11 01:24:38 1999
--- symtab.c	Fri Oct 29 11:14:50 1999
***************
*** 3729,3734 ****
--- 3737,3744 ----
       int block;
       char *last;
  {
+   enum language store_current=current_language->la_language;
+   
    if (last == NULL || strcmp (last, s->filename) != 0)
      {
        fputs_filtered ("\nFile ", gdb_stdout);
***************
*** 3748,3758 ****
             (kind == TYPES_NAMESPACE && 
              SYMBOL_NAMESPACE(sym) == STRUCT_NAMESPACE))
      {
        type_print (SYMBOL_TYPE (sym),
                    (SYMBOL_CLASS (sym) == LOC_TYPEDEF
                     ? "" : SYMBOL_SOURCE_NAME (sym)),
                    gdb_stdout, 0);
- 
        printf_filtered (";\n");
      }
    else
--- 3758,3774 ----
             (kind == TYPES_NAMESPACE &&
              SYMBOL_NAMESPACE(sym) == STRUCT_NAMESPACE))
      {
+      /*  Try to respect the local language  */
+       if ((language_mode == language_mode_auto) &&
+           (SYMBOL_LANGUAGE(sym) != language_unknown) &&
+            /* Is this possible ??? */
+           (SYMBOL_LANGUAGE(sym) != language_auto) &&
+           (current_language->la_language != SYMBOL_LANGUAGE(sym)))
+          set_language(SYMBOL_LANGUAGE(sym));
         type_print (SYMBOL_TYPE (sym),
                    (SYMBOL_CLASS (sym) == LOC_TYPEDEF
                     ? "" : SYMBOL_SOURCE_NAME (sym)),
                    gdb_stdout, 0);
        printf_filtered (";\n");
      }
    else
***************
*** 3779,3784 ****
--- 3795,3802 ----
          }
  # endif
      }
+   if (store_current != current_language->la_language)
+     set_language(store_current);
  }
  
  /* This help function for symtab_symbol_info() prints information






Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller@ics.u-strasbg.fr
Phone : (33)-3-88-41-40-07  Fax : (33)-3-88-41-40-99

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]