[RFA]: Fix gdb.base/long_long.exp for targets with 2-byte pointers

Andrew Cagney ac131313@cygnus.com
Wed Jun 6 09:07:00 GMT 2001


> +# Detect targets with 2-byte pointers.
> +
> +set sizeof_ptr 4
> +send_gdb "print sizeof(void*)\n"
> +gdb_expect {
> +    -re ".* = 2.*$gdb_prompt $" { set sizeof_ptr 2 }
> +    -re ".*$gdb_prompt $" { }
> +    default { }
> +}
> +


Just an FYI, from sizeof.exp:

proc get_sizeof { type default } {
     global gdb_prompt
     send_gdb "print/d sizeof (${type})\n"
     gdb_expect {
         -re "\\$\[0-9\]* = (\[0-9\]*).*$gdb_prompt $" {
             set size $expect_out(1,string)
             pass "get sizeof ${type} ($size)"
         }
         timeout {
             set size ${default}
             fail "get sizeof ${type} (timeout)"
         }
     }
     return ${size}
}

you may want to use something similar.

These patches are really Fernando's.

	Andrew




More information about the Gdb-patches mailing list