This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


> +# 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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]