Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Aleksandar Ristovski <ARistovski@qnx.com>
To: gdb-patches@sourceware.org
Cc: Ryan Mansfield <RMansfield@qnx.com>
Subject: [patch] Fix for varobj.c assertions.
Date: Thu, 10 Jan 2008 22:05:00 -0000	[thread overview]
Message-ID: <2F6320727174C448A52CEB63D85D11F40A8C@nova.ott.qnx.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 242 bytes --]

When listing children of a variable, if variable was not initialized we will
ignore return value from gdb_value_ind.

This patch fixes this situation. Fixes at least one problem from PR 2309.


---
Aleksandar Ristovski
QNX Software Systems



[-- Attachment #2: ChangeLog.txt --]
[-- Type: text/plain, Size: 233 bytes --]

2008-01-10  Aleksandar Ristovski  <aristovski@qnx.com>

	* varobj (adjust_value_for_child_access): Added checking for 
	returned value from gdb_value_ind.
	(c_describe_child): Likewise.
	(cplus_describe_child): Fixed a typo.


[-- Attachment #3: varobj.c.patch --]
[-- Type: application/octet-stream, Size: 1397 bytes --]

Index: gdb/varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.99
diff -u -p -r1.99 varobj.c
--- gdb/varobj.c	1 Jan 2008 22:53:13 -0000	1.99
+++ gdb/varobj.c	10 Jan 2008 21:59:04 -0000
@@ -1920,7 +1920,11 @@ adjust_value_for_child_access (struct va
 	  || TYPE_CODE (target_type) == TYPE_CODE_UNION)
 	{
 	  if (value && *value)
-	    gdb_value_ind (*value, value);	  
+	    {
+	      int success = gdb_value_ind (*value, value);	  
+	      if (!success)
+		*value = NULL;
+	    }
 	  *type = target_type;
 	  if (was_ptr)
 	    *was_ptr = 1;
@@ -2114,7 +2118,11 @@ c_describe_child (struct varobj *parent,
 	*cname = xstrprintf ("*%s", parent->name);
 
       if (cvalue && value)
-	gdb_value_ind (value, cvalue);
+	{
+	  int success = gdb_value_ind (value, cvalue);
+	  if (!success)
+	    *cvalue = NULL;
+	}
 
       /* Don't use get_target_type because it calls
 	 check_typedef and here, we want to show the true
@@ -2415,7 +2423,7 @@ cplus_describe_child (struct varobj *par
   adjust_value_for_child_access (&value, &type, &was_ptr);
 
   if (TYPE_CODE (type) == TYPE_CODE_STRUCT
-      || TYPE_CODE (type) == TYPE_CODE_STRUCT)
+      || TYPE_CODE (type) == TYPE_CODE_UNION)
     {
       char *join = was_ptr ? "->" : ".";
       if (CPLUS_FAKE_CHILD (parent))

             reply	other threads:[~2008-01-10 22:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-10 22:05 Aleksandar Ristovski [this message]
2008-01-10 22:37 ` Nick Roberts
2008-01-11  3:05 Aleksandar Ristovski
2008-01-11  4:50 ` Nick Roberts
2008-01-15 14:51 Aleksandar Ristovski
2008-01-15 22:20 ` Nick Roberts
2008-01-29 19:21   ` Daniel Jacobowitz

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=2F6320727174C448A52CEB63D85D11F40A8C@nova.ott.qnx.com \
    --to=aristovski@qnx.com \
    --cc=RMansfield@qnx.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