public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: moore@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM]  master: Don't descend into structure definitions when looking for a function definition
Date: Wed, 02 Jan 2008 22:39:00 -0000	[thread overview]
Message-ID: <20080102223938.10445.qmail@sourceware.org> (raw)

The branch, master has been updated
       via  a24692e579989250c60a2cbef2a32bd55b5790ca (commit)
      from  5d087b7b9f72f72791cc1349f384bf963c0599e5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit a24692e579989250c60a2cbef2a32bd55b5790ca
Author: Tim Moore <timoore@redhat.com>
Date:   Wed Jan 2 22:45:33 2008 +0100

    Don't descend into structure definitions when looking for a function definition
    
    This fixes Bugzilla 5467.
    
    frysk-sys/lib/dwfl/cni/ChangeLog:
    2008-01-02  Tim Moore  <timoore@redhat.com>
    
    	* cni/DwarfDie.cxx (iterate_decl): Don't descend into struture and
    	union types.
    
    frysk-core/frysk/hpd/ChangeLog:
    2008-01-02  Tim Moore  <timoore@redhat.com>
    
    	* TestBreakpoints.java (testBreakOnStructMemberName): New test.
    
    frsyk-core/frysk/pkglibdir/ChangeLog:
    2008-01-02  Tim Moore  <timoore@redhat.com>
    
    	* funit-structmember.c: New test with structure member and function
    	that share a name.

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/hpd/ChangeLog                  |    4 ++++
 frysk-core/frysk/hpd/TestBreakpoints.java       |   16 ++++++++++++++++
 frysk-core/frysk/pkglibdir/ChangeLog            |    5 +++++
 frysk-core/frysk/pkglibdir/funit-structmember.c |   17 +++++++++++++++++
 frysk-sys/lib/dwfl/ChangeLog                    |    5 +++++
 frysk-sys/lib/dwfl/cni/DwarfDie.cxx             |    8 ++++----
 6 files changed, 51 insertions(+), 4 deletions(-)
 create mode 100644 frysk-core/frysk/pkglibdir/funit-structmember.c

First 500 lines of diff:
diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog
index 3dfa4e7..8a026a6 100644
--- a/frysk-core/frysk/hpd/ChangeLog
+++ b/frysk-core/frysk/hpd/ChangeLog
@@ -1,3 +1,7 @@
+2008-01-02  Tim Moore  <timoore@redhat.com>
+
+	* TestBreakpoints.java (testBreakOnStructMemberName): New test.
+
 2007-12-20  Phil Muldoon  <pmuldoon@redhat.com>
 
 	* InfoCommand.java: New. Add auxv, maps, debuginfo.
diff --git a/frysk-core/frysk/hpd/TestBreakpoints.java b/frysk-core/frysk/hpd/TestBreakpoints.java
index 6c1eae2..7d5ad4b 100644
--- a/frysk-core/frysk/hpd/TestBreakpoints.java
+++ b/frysk-core/frysk/hpd/TestBreakpoints.java
@@ -173,4 +173,20 @@ public class TestBreakpoints
         e.expect("Quitting...");
         e.close();
     }
+
+  // Test if a breakpoint can be set on a function that has the same
+  // name as a structure member.
+
+  public void testBreakOnStructMemberName() {
+      e = HpdTestbed.run("funit-structmember");
+      e.send("break testfn\n");
+      e.expect("break.*" + prompt);
+      e.send("go\n");
+      e.expect("go.*" + prompt + ".*Breakpoint.*testfn.*");
+      e.send("where\n");
+      e.expect("where.*#0.* testfn *\\(.+\\).*" + prompt);
+      e.send("quit\n");
+      e.expect("Quitting...");
+      e.close();
+  }
 }
diff --git a/frysk-core/frysk/pkglibdir/ChangeLog b/frysk-core/frysk/pkglibdir/ChangeLog
index 01dd56d..21191c8 100644
--- a/frysk-core/frysk/pkglibdir/ChangeLog
+++ b/frysk-core/frysk/pkglibdir/ChangeLog
@@ -1,3 +1,8 @@
+2008-01-02  Tim Moore  <timoore@redhat.com>
+
+	* funit-structmember.c: New test with structure member and function
+	that share a name.
+
 2007-12-21  Petr Machata  <pmachata@redhat.com>
 
 	* funit-calls.c (recursive): New function.
diff --git a/frysk-core/frysk/pkglibdir/funit-structmember.c b/frysk-core/frysk/pkglibdir/funit-structmember.c
new file mode 100644
index 0000000..9f7ac39
--- /dev/null
+++ b/frysk-core/frysk/pkglibdir/funit-structmember.c
@@ -0,0 +1,17 @@
+#include <stdlib.h>
+
+struct Foo
+{
+  int (*testfn)(void);
+};
+
+int testfn(void)
+{
+  return 42;
+}
+
+int main()
+{
+  (void)testfn();
+  return 0;
+}
diff --git a/frysk-sys/lib/dwfl/ChangeLog b/frysk-sys/lib/dwfl/ChangeLog
index 99d3325..ad8aa0c 100644
--- a/frysk-sys/lib/dwfl/ChangeLog
+++ b/frysk-sys/lib/dwfl/ChangeLog
@@ -1,3 +1,8 @@
+2008-01-02  Tim Moore  <timoore@redhat.com>
+
+	* cni/DwarfDie.cxx (iterate_decl): Don't descend into struture and
+	union types.
+
 2007-12-14  Sami Wagiaalla  <swagiaal@redhat.com>
 
 	* DwarfDie.java (isDefinitionOnly): New function.
diff --git a/frysk-sys/lib/dwfl/cni/DwarfDie.cxx b/frysk-sys/lib/dwfl/cni/DwarfDie.cxx
index ea328be..9274ea8 100644
--- a/frysk-sys/lib/dwfl/cni/DwarfDie.cxx
+++ b/frysk-sys/lib/dwfl/cni/DwarfDie.cxx
@@ -571,16 +571,16 @@ iterate_decl (Dwarf_Die *die_p, char *sym, size_t nfiles)
 
       Dwarf_Word fileidx;
       attr = dwarf_attr (die, DW_AT_decl_file, &attr_mem);
+      int tag = dwarf_tag(die);
       // DW_TAG_enumerator doesn't have a DW_AT_decl_file
       if ((dwarf_formudata (attr, &fileidx) != 0 || (size_t)fileidx >= nfiles)
-	  && dwarf_tag (die) != DW_TAG_enumerator)
+	  && tag != DW_TAG_enumerator)
 	continue;
-
       if (name)
 	if (strcmp(name, sym) == 0)
 	  return die;
-
-      if (dwarf_haschildren (die))
+      if (dwarf_haschildren (die) && tag != DW_TAG_structure_type
+          && tag != DW_TAG_union_type)
 	{
 	  Dwarf_Die *result = iterate_decl (die, sym, nfiles);
 	  if (result != NULL)


hooks/post-receive
--
frysk system monitor/debugger


                 reply	other threads:[~2008-01-02 22:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20080102223938.10445.qmail@sourceware.org \
    --to=moore@sourceware.org \
    --cc=frysk-cvs@sourceware.org \
    --cc=frysk@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).