gdb/53: Something weird with void* types

fnasser@redhat.com fnasser@redhat.com
Thu May 10 10:38:00 GMT 2001


>Number:         53
>Category:       gdb
>Synopsis:       Something weird with void* types
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 10 10:38:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     fnasser@redhat.com
>Release:        CVS head
>Organization:
>Environment:
Red Hat Linux 7.0 and 7.1
>Description:
FYI, we are having to make a change in Insight to cope with a funny
thing that recently appeared in GDB.

The target type of a void* does not have the type name set to "void" any
longer.

(gdb) p *type
$3 = {code = TYPE_CODE_PTR, name = 0x0, tag_name = 0x0, length = 4, 
  upper_bound_type = 0, lower_bound_type = 0, objfile = 0x854e998, 
  target_type = 0x8bcd5d8, pointer_type = 0x0, reference_type = 0x0, 
  cv_type = 0x8bcd61c, flags = 1, nfields = 0, fields = 0x0, 
  vptr_basetype = 0x0, vptr_fieldno = -1, type_specific = {arg_types =
0x0, 
    cplus_stuff = 0x0}}
(gdb) p *target
$4 = {code = TYPE_CODE_VOID, name = 0x0, tag_name = 0x0, length = 1, 
  upper_bound_type = 0, lower_bound_type = 0, objfile = 0x854e998, 
  target_type = 0x0, pointer_type = 0x8bcd61c, reference_type = 0x0, 
  cv_type = 0x8bcd5d8, flags = 0, nfields = 0, fields = 0x0, 
  vptr_basetype = 0x0, vptr_fieldno = -1, type_specific = {arg_types =
0x0, 
    cplus_stuff = 0x0}}

As you see, TYPE_CODE_VOID does not have a name anymore, at least when
it is the target of a (void *) type.
>How-To-Repeat:
Create a simple program with a (void *) and debug it with GDB.
Attach a second GDB to this GDB and put a breakpoint in any of the functions that get the type of variables.
Issue a command (like print) on the inferior GDB to force it into the function where you placed the breakpoint.
Look at the (void *) type and at the target_type entry.
You should get the output as above (with the name field of the target_type empty).
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gdb-prs mailing list