Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] fixed inherit_abstract_dies infinite recursive call
@ 2014-01-20  4:25 manjian2006
  2014-01-20  5:53 ` Tom Tromey
  2014-01-20  6:30 ` manjian2006
  0 siblings, 2 replies; 7+ messages in thread
From: manjian2006 @ 2014-01-20  4:25 UTC (permalink / raw)
  To: gdb-patches; +Cc: linzj

From: linzj <linzj@ucweb.com>

A dwarf die may have the following relationship:
564860c<-----------------------------
  |                                 |
  |(abstract origin)                |
  |                                 |
  V                                 |
5816d55                             | (abstract origin)
  |                                 |
  |(child)                          |
  |                                 |
  V                                 |
  ...                               |
5812c34------------------------------
So inherit_abstract_dies may results in infinite recursive call.
A bit field call in_process has been add to struct die_info to fix this problem.
process_die would first check if a die is in processing state, if so,just return.
Then in_process bit is set.Before process_die returns,this bit field is unset.
---
 gdb/dwarf2read.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 7ca527d..4532251 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1224,6 +1224,8 @@ struct die_info
     /* True if we're presently building the full type name for the
        type derived from this DIE.  */
     unsigned char building_fullname : 1;
+    /* True if this die is in process */
+    unsigned char in_process : 1;
 
     /* Abbrev number */
     unsigned int abbrev;
@@ -8013,6 +8015,10 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu)
 static void
 process_die (struct die_info *die, struct dwarf2_cu *cu)
 {
+  /* Only process those who are not in process */
+  if(die->in_process)
+    return;
+  die->in_process = 1;
   switch (die->tag)
     {
     case DW_TAG_padding:
@@ -8100,6 +8106,7 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
       new_symbol (die, NULL, cu);
       break;
     }
+    die->in_process = 0;
 }
 \f
 /* DWARF name computation.  */
-- 
1.8.3.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-01-22  2:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-20  4:25 [PATCH] fixed inherit_abstract_dies infinite recursive call manjian2006
2014-01-20  5:53 ` Tom Tromey
2014-01-21  1:43   ` manjian2006
2014-01-21  7:54     ` Joel Brobecker
2014-01-21 10:17       ` manjian2006
2014-01-20  6:30 ` manjian2006
2014-01-22  2:45   ` Doug Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox