--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
03-01-2010, 05:48 PM
"Chouinard, Luc"
sial: Oops drilldowntype for bool
Hi Michael -
How did a fundamental bool type (which, if I'm not mistacking, is a c++
type) got into a kernel object?
I think that the answer is to map it to TYPE_CODE_CHAR regarless, so
that the size would be properly handled in structs. c++ seems to be
mapping a bool to a char from a size perspective.
-Luc
> -----Original Message-----
> From: Michael Holzheu [mailto:holzheu@linux.vnet.ibm.com]
> Sent: Monday, March 01, 2010 1:21 PM
> To: Chouinard, Luc
> Cc: crash
> Subject: [PATCH] sial: Oops drilldowntype for bool
>
> Hi Luc,
>
> I have a sial script that uses structures that contain
> members of type "bool". When I run the script I get:
>
> File ../devices.sial, line 279, Error: Oops drilldowntype
>
> I looked into the sial code and found that the
> drilldowntype() functions fails because no "case
> TYPE_CODE_BOOL" is defined.
>
> Here the break point at sial.c (323):
>
> default:.
> sial_error("Oops drilldowntype");
>
> Breakpoint 1, drilldowntype (type=0x81f088a8, t=0x808023e8) at
> sial.c:323
> 323 sial_error("Oops drilldowntype");
>
> (gdb) print *type
> $1 = {pointer_type = 0x0, reference_type = 0x0, chain = 0x81f088a8,
> instance_flags = 0, length = 1, main_type = 0x81f088d0}
>
> (gdb) print *type->main_type
> $2 = {code = TYPE_CODE_BOOL, flag_unsigned = 1, flag_nosign = 0,
> flag_stub = 0, flag_target_stub = 0, flag_static = 0,
> flag_prototyped = 0,
> flag_incomplete = 0, flag_varargs = 0, flag_vector = 0,
> flag_stub_supported = 0, flag_nottext = 0, flag_fixed_instance = 0,
> flag_objfile_owned = 1, nfields = 0, vptr_fieldno = -1,
> name = 0x200040d8257 "_Bool", tag_name = 0x0, owner =
> {objfile = 0x80618e10,
> gdbarch = 0x80618e10}, target_type = 0x0, fields = 0x0,
> vptr_basetype = 0x0, type_specific = {cplus_stuff = 0x0,
> floatformat = 0x0,
> calling_convention = 0}}
>
> When I add "case TYPE_CODE_BOOL" and handle it like "case
> TYPE_CODE_INT"
> my script works, but I am not sure if that fix is correct.
>
> What do you think?
>
> Michael
> ---
> extensions/sial.c | 1 +
> 1 file changed, 1 insertion(+)
>
> --- a/extensions/sial.c
> +++ b/extensions/sial.c
> @@ -286,6 +286,7 @@ int nidx=0;
> type=TYPE_TARGET_TYPE(type);
> break;
>
> + case TYPE_CODE_BOOL:
> case TYPE_CODE_INT:
>
> sial_parsetype(tstr=TYPE_NAME(type), t, 0);
>
>
>
Confidentiality Notice: This e-mail (including any attachments) is intended only for the recipients named above. It may contain confidential or privileged information and should not be read, copied or otherwise used by any other person. If you are not a named recipient, please notify the sender of that fact and delete the e-mail from your system.
--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
03-02-2010, 08:32 AM
Michael Holzheu
sial: Oops drilldowntype for bool
Hallo Luc,
On Mon, 2010-03-01 at 13:48 -0500, Chouinard, Luc wrote:
> Hi Michael -
> How did a fundamental bool type (which, if I'm not mistacking, is a c++
> type) got into a kernel object?
I assume that this comes from the C99 datatype "_Bool". This is used in
the kernel to define "bool":
> I think that the answer is to map it to TYPE_CODE_CHAR regarless, so
> that the size would be properly handled in structs. c++ seems to be
> mapping a bool to a char from a size perspective.
Agreed, so would the following be the correct patch?
---
extensions/sial.c | 4 ++++
1 file changed, 4 insertions(+)
+ case TYPE_CODE_BOOL:
+ sial_parsetype("char", t, ref);
+ type=0;
+ break;
case TYPE_CODE_UNION:
sial_type_mkunion(t);
goto label;
--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
03-02-2010, 11:44 AM
"Chouinard, Luc"
sial: Oops drilldowntype for bool
Got it.
Yes, this is the proper fix.
Please go ahead and submit it.
Thanks.
-Luc
> -----Original Message-----
> From: Michael Holzheu [mailto:holzheu@linux.vnet.ibm.com]
> Sent: Tuesday, March 02, 2010 4:32 AM
> To: Chouinard, Luc
> Cc: crash
> Subject: RE: [PATCH] sial: Oops drilldowntype for bool
>
> Hallo Luc,
>
> On Mon, 2010-03-01 at 13:48 -0500, Chouinard, Luc wrote:
> > Hi Michael -
> > How did a fundamental bool type (which, if I'm not mistacking, is a
> > c++
> > type) got into a kernel object?
>
> I assume that this comes from the C99 datatype "_Bool". This
> is used in the kernel to define "bool":
>
> types.h:typedef _Bool bool;
>
> crash> whatis bool
> _Bool
> crash> whatis _Bool
> _Bool
>
> (gdb) print *type->main_type
> $2 = {code = TYPE_CODE_BOOL, flag_unsigned = 1, flag_nosign = 0, ...
> name = 0x200040d8257 "_Bool", tag_name = 0x0, owner = {objfile =
>
> > I think that the answer is to map it to TYPE_CODE_CHAR
> regarless, so
> > that the size would be properly handled in structs. c++ seems to be
> > mapping a bool to a char from a size perspective.
>
> Agreed, so would the following be the correct patch?
> ---
> extensions/sial.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> --- a/extensions/sial.c
> +++ b/extensions/sial.c
> @@ -292,6 +292,10 @@ int nidx=0;
> type=0;
> break;
>
> + case TYPE_CODE_BOOL:
> + sial_parsetype("char", t, ref);
> + type=0;
> + break;
> case TYPE_CODE_UNION:
> sial_type_mkunion(t);
> goto label;
>
>
>
Confidentiality Notice: This e-mail (including any attachments) is intended only for the recipients named above. It may contain confidential or privileged information and should not be read, copied or otherwise used by any other person. If you are not a named recipient, please notify the sender of that fact and delete the e-mail from your system.
--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility