Skip to content
Snippets Groups Projects
  • Pedro Alves's avatar
    751495be
    Make "ptype INTERNAL_FUNCTION" in Ada print like other languages · 751495be
    Pedro Alves authored
    
    Currently, printing the type of an internal function in Ada shows
    double <>s, like:
    
     (gdb) with language ada -- ptype $_isvoid
     type = <<internal function>>
    
    while all other languages print it with a single <>, like:
    
     (gdb) with language c -- ptype $_isvoid
     type = <internal function>
    
    I don't think there's a reason that Ada needs to be different.  We
    currently print the double <>s because we take this path in
    ada_print_type:
    
        switch (type->code ())
          {
          default:
    	gdb_printf (stream, "<");
    	c_print_type (type, "", stream, show, level, language_ada, flags);
    	gdb_printf (stream, ">");
    	break;
    
    ... and the type's name already has the <>s.
    
    Fix this by simply adding an early check for
    TYPE_CODE_INTERNAL_FUNCTION.
    
    Approved-By: default avatarAndrew Burgess <aburgess@redhat.com>
    Approved-By: default avatarTom Tromey <tom@tromey.com>
    Change-Id: Ic2b6527b9240a367471431023f6e27e6daed5501
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30105
    751495be
    History
    Make "ptype INTERNAL_FUNCTION" in Ada print like other languages
    Pedro Alves authored
    
    Currently, printing the type of an internal function in Ada shows
    double <>s, like:
    
     (gdb) with language ada -- ptype $_isvoid
     type = <<internal function>>
    
    while all other languages print it with a single <>, like:
    
     (gdb) with language c -- ptype $_isvoid
     type = <internal function>
    
    I don't think there's a reason that Ada needs to be different.  We
    currently print the double <>s because we take this path in
    ada_print_type:
    
        switch (type->code ())
          {
          default:
    	gdb_printf (stream, "<");
    	c_print_type (type, "", stream, show, level, language_ada, flags);
    	gdb_printf (stream, ">");
    	break;
    
    ... and the type's name already has the <>s.
    
    Fix this by simply adding an early check for
    TYPE_CODE_INTERNAL_FUNCTION.
    
    Approved-By: default avatarAndrew Burgess <aburgess@redhat.com>
    Approved-By: default avatarTom Tromey <tom@tromey.com>
    Change-Id: Ic2b6527b9240a367471431023f6e27e6daed5501
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30105