This is the mail archive of the 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]
Other format: [Raw text]

Re: [PATCH] Run gdb.base/sizeof.exp with board having gdb,noinferiorio

On 12/01/2015 01:43 PM, Yao Qi wrote:
> In my remote cross testing (x86_64 host and aarch64 target), the test
> gdb.base/sizeof.exp is skipped because gdb,noinferiorio is defined in
> my gdbserver board file.  Tests are skipped because the test checks
> the expected value from the program's output, but I don't see why must
> do it this way.  With my patch applied, we can save the result in variable
> in the program, and check the variable then.  Then, the test doesn't rely
> on inferiorio.  However, in check_valueof, the value is still checked by
> printing from the program, because I don't know why do we test in this
> way, so I leave them there.

We're checking whether gdb [1] and the compiler agree on the signness of "char":

These casts are evaluated by gdb:

  set signof_char [get_integer_valueof "(int) (char) -1" -1]

While these are evaluated by the compiler:

  printf ("valueof ((int) (char) -1) == %d\n", (int) (char) -1);

If char is unsigned, that prints 0xff; if char is signed, it prints -1.

I think we can replace that like you did for sizeof.

  value = (int) (char) -1;

etc., and then check "p value = ${val}", just like you did for
the sizeof checks.

[1] - This is gdbarch_char_signed.

Pedro Alves

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