From: msnyder@sonic.net
To: gdb-patches@sourceware.org
Cc: ghost@cs.msu.su
Subject: [PATCH] varobj.c (cplus_describe_child): guard null (resubmit)
Date: Mon, 13 Aug 2007 22:43:00 -0000 [thread overview]
Message-ID: <18292.12.7.175.2.1187044963.squirrel@webmail.sonic.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 101 bytes --]
Adapted from Vladimir's suggestion. The switch default
allows the pointer to be null at this point.
[-- Attachment #2: 304b.txt --]
[-- Type: text/plain, Size: 1557 bytes --]
2007-08-13 Michael Snyder <msnyder@access-company.com>
* varobj.c (cplus_describe_child): Guard against null.
Use "NULL" instead of "0" to initialize pointers.
Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.90
diff -p -r1.90 varobj.c
*** varobj.c 8 Aug 2007 21:46:37 -0000 1.90
--- varobj.c 13 Aug 2007 22:37:46 -0000
*************** static void
*** 2315,2321 ****
cplus_describe_child (struct varobj *parent, int index,
char **cname, struct value **cvalue, struct type **ctype)
{
! char *name = 0;
struct value *value;
struct type *type;
--- 2315,2321 ----
cplus_describe_child (struct varobj *parent, int index,
char **cname, struct value **cvalue, struct type **ctype)
{
! char *name = NULL;
struct value *value;
struct type *type;
*************** cplus_describe_child (struct varobj *par
*** 2396,2402 ****
}
else
{
! char *access = 0;
int children[3];
cplus_class_num_children (type, children);
--- 2396,2402 ----
}
else
{
! char *access = NULL;
int children[3];
cplus_class_num_children (type, children);
*************** cplus_describe_child (struct varobj *par
*** 2435,2441 ****
/* error! */
break;
}
!
if (cname)
*cname = xstrdup (access);
--- 2435,2442 ----
/* error! */
break;
}
!
! gdb_assert (access);
if (cname)
*cname = xstrdup (access);
next reply other threads:[~2007-08-13 22:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-13 22:43 msnyder [this message]
2007-08-14 3:02 ` Vladimir Prus
2007-08-14 3:10 ` Daniel Jacobowitz
2007-08-14 18:28 ` msnyder
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=18292.12.7.175.2.1187044963.squirrel@webmail.sonic.net \
--to=msnyder@sonic.net \
--cc=gdb-patches@sourceware.org \
--cc=ghost@cs.msu.su \
/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