This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

Re: [RFA/commit] DWARF: Add support for DW_TAG_constant DIEs


On Thu, 16 Sep 2010 22:22:26 +0200, Joel Brobecker wrote:
> The GNAT compiler is starting to email DW_TAG_constant dies,

gfortran emits them since 2008:
	http://pkgs.fedoraproject.org/gitweb/?p=gdb.git;a=blob;f=gdb-6.8-fortran-tag-constant.patch;hb=HEAD

>From the differences:

die_needs_namespace: DW_TAG_constant is missing in your patch, tested by the
attached testcase.  For gfortran-4.5 it has a prerequisite:
	[patch] regression on gfortran-4.5: stopped language detection
	http://sourceware.org/ml/gdb-patches/2010-09/msg00329.html
(for gdb.fortran/* one must create ln -s /usr/bin/gfortran $topdir/g77)

For add_partial_symbol - why do you make DW_TAG_constant different from
DW_TAG_variable?  DW_TAG_variable would handle more cases there.

Otherwise the patch of mine was forcing TYPE_CONST on that type but it is
unclear whether it should not be rather emitted by GCC.  DW_TAG_const_type is
emitted by gfortran.  So GDB is probably OK without forcing it.


Thanks,
Jan


gdb/
2010-09-19  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* dwarf2read.c (die_needs_namespace) <DW_TAG_variable>: Add also
	DW_TAG_constant.

gdb/testsuite/
2010-09-19  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.fortran/module.exp (fully qualified name of DW_TAG_constant):
	New test.
	* gdb.fortran/module.f90 (mod1) <var_const>: New constant.

--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -4599,6 +4601,7 @@ die_needs_namespace (struct die_info *die, struct dwarf2_cu *cu)
       return 1;
 
     case DW_TAG_variable:
+    case DW_TAG_constant:
       /* We only need to prefix "globally" visible variables.  These include
 	 any variable marked with DW_AT_external or any variable that
 	 lives in a namespace.  [Variables in anonymous namespaces
--- a/gdb/testsuite/gdb.fortran/module.exp
+++ b/gdb/testsuite/gdb.fortran/module.exp
@@ -26,6 +26,8 @@ if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f77}] } {
 # The current source language is "auto; currently fortran".
 gdb_test "p modmany::var_i" " = 14" "stopped language detection"
 
+gdb_test "print mod1::var_const" " = 20" "fully qualified name of DW_TAG_constant"
+
 if ![runto MAIN__] then {
     perror "couldn't run to breakpoint MAIN__"
     continue
--- a/gdb/testsuite/gdb.fortran/module.f90
+++ b/gdb/testsuite/gdb.fortran/module.f90
@@ -15,6 +15,8 @@
 
 module mod1
         integer :: var_i = 1
+        integer :: var_const
+        parameter (var_const = 20)
 end module mod1
 
 module mod2


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