Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: David Edelsohn <dje@watson.ibm.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] C++ Dwarf2 inner scope PR/789
Date: Mon, 07 Oct 2002 21:10:00 -0000	[thread overview]
Message-ID: <200210080410.AAA29076@makai.watson.ibm.com> (raw)

	While debugging a C++ application compiled with g++-3.2 and Dwarf2
debugging information, we discovered that some functions would not have
any symbols available.  This problem occurs when a method is defined
inside a class-local function and prevents any symbols from appearing.

	We traced this back to gdb/dwarf2read.c:read_func_scope().  That
function is called recursively for the inner scope, but it currently is
written to always pop back to file scope instead of the previous scope.
The appended patch saves the current scope in a local variable on the
stack and restores that scope after parsing the inner scope.  This allows
global symbols to be seen, but we still have not been able to fix the
innermost scope problem.

Thanks, David


--- dwarf2read.c.orig	Sun Oct  6 15:00:32 2002
+++ dwarf2read.c	Sun Oct  6 14:05:39 2002
@@ -1663,6 +1663,7 @@ read_func_scope (struct die_info *die, s
   struct die_info *child_die;
   struct attribute *attr;
   char *name;
+  struct pending **prev_list_in_scope;
 
   name = dwarf2_linkage_name (die);
 
@@ -1704,6 +1705,7 @@ read_func_scope (struct die_info *die, s
 
   new = push_context (0, lowpc);
   new->name = new_symbol (die, die->type, objfile, cu_header);
+  prev_list_in_scope = list_in_scope;
   list_in_scope = &local_symbols;
 
   if (die->has_children)
@@ -1720,7 +1722,10 @@ read_func_scope (struct die_info *die, s
   /* Make a block for the local symbols within.  */
   finish_block (new->name, &local_symbols, new->old_blocks,
 		lowpc, highpc, objfile);
-  list_in_scope = &file_symbols;
+  
+  local_symbols = new->locals;
+  param_symbols = new->params;
+  list_in_scope = prev_list_in_scope;
 }
 
 /* Process all the DIES contained within a lexical block scope.  Start


             reply	other threads:[~2002-10-08  4:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-07 21:10 David Edelsohn [this message]
2002-10-10 13:26 ` Jim Blandy
2002-10-10 13:27   ` David Edelsohn
2002-10-28 13:37     ` David Edelsohn
2002-11-04 13:19       ` Jim Blandy
2002-10-10 13:27 ` Jim Blandy

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=200210080410.AAA29076@makai.watson.ibm.com \
    --to=dje@watson.ibm.com \
    --cc=gdb-patches@sources.redhat.com \
    /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