* [patch] gnu-v2-abi.c: strchr may return null
@ 2007-08-29 21:26 msnyder
2007-09-04 14:18 ` Joel Brobecker
0 siblings, 1 reply; 4+ messages in thread
From: msnyder @ 2007-08-29 21:26 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: 112.txt --]
[-- Type: text/plain, Size: 1500 bytes --]
2007-08-29 Michael Snyder <msnyder@access-company.com>
* gnu-v2-abi.c (gnuv2_value_rtti_type): Guard against null.
Index: gnu-v2-abi.c
===================================================================
RCS file: /cvs/src/src/gdb/gnu-v2-abi.c,v
retrieving revision 1.25
diff -p -r1.25 gnu-v2-abi.c
*** gnu-v2-abi.c 23 Aug 2007 18:08:33 -0000 1.25
--- gnu-v2-abi.c 29 Aug 2007 21:24:09 -0000
*************** gnuv2_value_rtti_type (struct value *v,
*** 192,198 ****
CORE_ADDR vtbl;
struct minimal_symbol *minsym;
struct symbol *sym;
! char *demangled_name;
struct type *btype;
if (full)
--- 192,198 ----
CORE_ADDR vtbl;
struct minimal_symbol *minsym;
struct symbol *sym;
! char *demangled_name, *p;
struct type *btype;
if (full)
*************** gnuv2_value_rtti_type (struct value *v,
*** 252,258 ****
/* If we just skip the prefix, we get screwed by namespaces */
demangled_name=cplus_demangle(demangled_name,DMGL_PARAMS|DMGL_ANSI);
! *(strchr(demangled_name,' '))=0;
/* Lookup the type for the name */
/* FIXME: chastain/2003-11-26: block=NULL is bogus. See pr gdb/1465. */
--- 252,260 ----
/* If we just skip the prefix, we get screwed by namespaces */
demangled_name=cplus_demangle(demangled_name,DMGL_PARAMS|DMGL_ANSI);
! p = strchr (demangled_name, ' ');
! if (p)
! *p = '\0';
/* Lookup the type for the name */
/* FIXME: chastain/2003-11-26: block=NULL is bogus. See pr gdb/1465. */
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] gnu-v2-abi.c: strchr may return null
2007-08-29 21:26 [patch] gnu-v2-abi.c: strchr may return null msnyder
@ 2007-09-04 14:18 ` Joel Brobecker
2007-09-04 14:20 ` Daniel Jacobowitz
2007-09-05 0:04 ` msnyder
0 siblings, 2 replies; 4+ messages in thread
From: Joel Brobecker @ 2007-09-04 14:18 UTC (permalink / raw)
To: msnyder; +Cc: gdb-patches
> 2007-08-29 Michael Snyder <msnyder@access-company.com>
>
> * gnu-v2-abi.c (gnuv2_value_rtti_type): Guard against null.
This looks OK to me, but can you give it a few more days so that Daniel
can provide any comment on it (C++ is not our main focus at AdaCore)?
I'm thinking this is perhaps a case where an assert might be better:
Does the rest of the function make any sense if we don't find our
space? I don't know the encoding so perhaps it's OK to give it a try...
> Index: gnu-v2-abi.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/gnu-v2-abi.c,v
> retrieving revision 1.25
> diff -p -r1.25 gnu-v2-abi.c
> *** gnu-v2-abi.c 23 Aug 2007 18:08:33 -0000 1.25
> --- gnu-v2-abi.c 29 Aug 2007 21:24:09 -0000
> *************** gnuv2_value_rtti_type (struct value *v,
> *** 192,198 ****
> CORE_ADDR vtbl;
> struct minimal_symbol *minsym;
> struct symbol *sym;
> ! char *demangled_name;
> struct type *btype;
>
> if (full)
> --- 192,198 ----
> CORE_ADDR vtbl;
> struct minimal_symbol *minsym;
> struct symbol *sym;
> ! char *demangled_name, *p;
> struct type *btype;
>
> if (full)
> *************** gnuv2_value_rtti_type (struct value *v,
> *** 252,258 ****
>
> /* If we just skip the prefix, we get screwed by namespaces */
> demangled_name=cplus_demangle(demangled_name,DMGL_PARAMS|DMGL_ANSI);
> ! *(strchr(demangled_name,' '))=0;
>
> /* Lookup the type for the name */
> /* FIXME: chastain/2003-11-26: block=NULL is bogus. See pr gdb/1465. */
> --- 252,260 ----
>
> /* If we just skip the prefix, we get screwed by namespaces */
> demangled_name=cplus_demangle(demangled_name,DMGL_PARAMS|DMGL_ANSI);
> ! p = strchr (demangled_name, ' ');
> ! if (p)
> ! *p = '\0';
>
> /* Lookup the type for the name */
> /* FIXME: chastain/2003-11-26: block=NULL is bogus. See pr gdb/1465. */
--
Joel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] gnu-v2-abi.c: strchr may return null
2007-09-04 14:18 ` Joel Brobecker
@ 2007-09-04 14:20 ` Daniel Jacobowitz
2007-09-05 0:04 ` msnyder
1 sibling, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2007-09-04 14:20 UTC (permalink / raw)
To: Joel Brobecker; +Cc: msnyder, gdb-patches
On Tue, Sep 04, 2007 at 07:18:30AM -0700, Joel Brobecker wrote:
> > 2007-08-29 Michael Snyder <msnyder@access-company.com>
> >
> > * gnu-v2-abi.c (gnuv2_value_rtti_type): Guard against null.
>
> This looks OK to me, but can you give it a few more days so that Daniel
> can provide any comment on it (C++ is not our main focus at AdaCore)?
I've no objection - and I don't really care about this file; it only
affects g++ 2.95.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] gnu-v2-abi.c: strchr may return null
2007-09-04 14:18 ` Joel Brobecker
2007-09-04 14:20 ` Daniel Jacobowitz
@ 2007-09-05 0:04 ` msnyder
1 sibling, 0 replies; 4+ messages in thread
From: msnyder @ 2007-09-05 0:04 UTC (permalink / raw)
To: Joel Brobecker; +Cc: msnyder, gdb-patches
>> 2007-08-29 Michael Snyder <msnyder@access-company.com>
>>
>> * gnu-v2-abi.c (gnuv2_value_rtti_type): Guard against null.
>
> This looks OK to me, but can you give it a few more days so that Daniel
> can provide any comment on it (C++ is not our main focus at AdaCore)?
On Daniel's subsequent approval (or acquiescence?), committing.
> I'm thinking this is perhaps a case where an assert might be better:
> Does the rest of the function make any sense if we don't find our
> space? I don't know the encoding so perhaps it's OK to give it a try...
Well, it won't make it any worse. If any reason manifests itself
to go with an assert, we can do that.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-09-05 0:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-29 21:26 [patch] gnu-v2-abi.c: strchr may return null msnyder
2007-09-04 14:18 ` Joel Brobecker
2007-09-04 14:20 ` Daniel Jacobowitz
2007-09-05 0:04 ` msnyder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox