public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA/commit] DWARF: Add support for DW_TAG_constant DIEs
Date: Sun, 19 Sep 2010 23:02:00 -0000	[thread overview]
Message-ID: <20100919173918.GA29737@host1.dyn.jankratochvil.net> (raw)
In-Reply-To: <1284668546-25877-1-git-send-email-brobecker@adacore.com>

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

  parent reply	other threads:[~2010-09-19 17:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-16 21:31 Joel Brobecker
2010-09-16 22:23 ` Nathan Froyd
2010-09-16 22:29   ` Joel Brobecker
2010-09-17 13:11     ` Pedro Alves
2010-09-19 23:02 ` Jan Kratochvil [this message]
2010-09-21 18:41   ` Joel Brobecker
2010-09-21 19:43     ` Jan Kratochvil
2010-09-22 18:43       ` Joel Brobecker
2010-09-22 19:42         ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100919173918.GA29737@host1.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).