www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/09/19/09:27:38

Date: Thu, 19 Sep 1996 15:12:09 +0200 (METDST)
From: Robert Hoehne <robert DOT hoehne AT mathematik DOT tu-chemnitz DOT de>
To: bug-gcc AT prep DOT ai DOT mit DOT edu
Cc: Salvador Eduardo Tropea <ice AT inti DOT edu DOT ar>,
DJGPP workers <djgpp-workers AT delorie DOT com>
Subject: Patch for go32.h of gcc 2.7.2.1
Message-Id: <Pine.HPP.3.91.960919150508.10670A-100000@newton.mathematik.tu-chemnitz.de>
Mime-Version: 1.0

Sorry for the previous patch, but is was a result of very poor
documentation about stabs debugging format. The previous patch
works only, when the compiled code with stabs is used by GDB 4.12
or earlyer because this version assume, that the linenumbers etc.
are absolute to the .text section. The GDB 4.16 now assumes, that
these information are relative to the function.
But I'm a little confused by the documentations. The gcc doc says,
the the normal case is, to put these information as absolute values
but GDB now assumes, that ALL coff files with stabs debugging info
have them relative.

Here is a patch for the file
'go32.h' in the dircetory 'config/i386' of the gcc distribution.

The patch is against the file from gcc 2.7.2.1.

Description of the patch:
The patch allows the user of gcc on DJGPP to produce stabs debugging
information with the '-gstabs' commandline switch. This is very usefull
when debugging c++ programs because it is much bether than sdb debugging
information. The sdb debugging information is still the default setting.

And the next change handles a bug with emitting the right filename
in the generated assembler file. Currently the there is the dump_base_name
used, but this is not correct, because the gcc driver calls
cc1 or cc1plus with '-dumpbase fo.cc', even when compiling a file
'foo.cpp'. I have changed this to use the main_input_name, which
point to the correct filename.

This bug is related not only to DJGPP, but I cannot say something
about the other platforms, probably the same patch can be applied to
them.

Because the patch has to to only with the DJGPP port of gcc, it cannot
break anything on other platforms.


Robert

*** config/i386/go32.h~	Thu Sep 19 15:03:15 1996
--- config/i386/go32.h	Thu Sep 19 15:01:57 1996
***************
*** 1,5 ****
--- 1,9 ----
  /* Configuration for an i386 running MS-DOS with djgpp/go32.  */
  
+ #define DBX_DEBUGGING_INFO /* support for stabs debugging info */
+ #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG /* leave sdb as default */
+ #define NO_STAB_H /* DJGPP has no stab.h */
+ 
  /* Don't assume anything about the header files. */
  #define NO_IMPLICIT_EXTERN_C
  
***************
*** 61,64 ****
--- 65,95 ----
      fprintf (FILE, "\n");			\
    } while (0)
  
+ /* Output at beginning of assembler file.  */
+ /* The .file command should always begin the output.  */
+ /* Use the main_input_filename instead of dump_base_name */
+ 
+ #undef ASM_FILE_START
+ #define ASM_FILE_START(FILE)						\
+   do {									\
+ 	output_file_directive (FILE, main_input_filename);		\
+   } while (0)
+ 
+ /* Be function-relative for block and source line stab directives. */
+ 
+ #define DBX_BLOCKS_FUNCTION_RELATIVE 1
+ 
+ /* but, to make this work, functions must appear prior to line info */
+ 
+ #define DBX_FUNCTION_FIRST
+ 
+ #undef  ASM_OUTPUT_SOURCE_LINE
+ #define ASM_OUTPUT_SOURCE_LINE(file, line)		\
+   { static int sym_lineno = 1;				\
+     fprintf (file, ".stabn 68,0,%d,.LM%d-",		\
+ 	     line, sym_lineno);				\
+     assemble_name (file,				\
+ 		   XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
+     fprintf (file, "\n.LM%d:\n", sym_lineno);		\
+     sym_lineno += 1; }
  


*****************************************************************
* Robert Hoehne, Fakultaet fuer Mathematik, TU-Chemnitz-Zwickau *
* Post:    Am Berg 3, D-09573 Dittmannsdorf                     *
* e-Mail:  Robert DOT Hoehne AT Mathematik DOT TU-Chemnitz DOT DE              *
* WWW:     http://www.tu-chemnitz.de/~rho                       *
*****************************************************************

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019