Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] Fix for varobj.c assertions.
@ 2008-01-10 22:05 Aleksandar Ristovski
  2008-01-10 22:37 ` Nick Roberts
  0 siblings, 1 reply; 7+ messages in thread
From: Aleksandar Ristovski @ 2008-01-10 22:05 UTC (permalink / raw)
  To: gdb-patches; +Cc: Ryan Mansfield

[-- 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))

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [patch] Fix for varobj.c assertions.
@ 2008-01-11  3:05 Aleksandar Ristovski
  2008-01-11  4:50 ` Nick Roberts
  0 siblings, 1 reply; 7+ messages in thread
From: Aleksandar Ristovski @ 2008-01-11  3:05 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb-patches, Ryan Mansfield

> 
> I use:
> 
> gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)
> Ubuntu 7.04 (2.6.20-15-generic)
> 

What is your gdb version?


^ permalink raw reply	[flat|nested] 7+ messages in thread
* RE: [patch] Fix for varobj.c assertions.
@ 2008-01-15 14:51 Aleksandar Ristovski
  2008-01-15 22:20 ` Nick Roberts
  0 siblings, 1 reply; 7+ messages in thread
From: Aleksandar Ristovski @ 2008-01-15 14:51 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb-patches, Ryan Mansfield

> 
> Aleksandar Ristovski writes:
>  > >
>  > > I use:
>  > >
>  > > gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)
>  > > Ubuntu 7.04 (2.6.20-15-generic)
>  > >
>  >
>  > What is your gdb version?
> 
> Perhaps I should have said.  Current CVS: GNU gdb 6.7.50.20080109-cvs.
> 
> Can anybody else duplicate this problem? (see pr2309)
> 

I did some more testing, it turns out it depends on the toolchain version.

Toolchain that produced the problem:
gcc 4.1.1
binutils 2.17

However, with
gcc 4.1.2
binutils 2.18
the problem does not reproduce.


The patch fixes the problem in the case of problematic toolchain version.



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

end of thread, other threads:[~2008-01-29 19:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-10 22:05 [patch] Fix for varobj.c assertions Aleksandar Ristovski
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

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