public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFA] (riscv/ada) fix error when calling functions with range argument
@ 2019-02-10 13:38 Joel Brobecker
  2019-02-12 13:29 ` Andrew Burgess
  2019-02-12 16:54 ` Tom Tromey
  0 siblings, 2 replies; 12+ messages in thread
From: Joel Brobecker @ 2019-02-10 13:38 UTC (permalink / raw)
  To: gdb-patches; +Cc: KONRAD Frederic

From: KONRAD Frederic <konrad@adacore.com>

Hello,

This is a patch that one of my coworkers wrote, which I have been
meaning to contribute for a long time, but haven't because we are not
set up to run the official testsuite on this platform (because of
the way our baremetal compiler is set up). But since the patch is
quite straightforward in my opinion, I thought I would propose it
anyway.

Using the gdb.ada/call_pn.exp testcase, and running it by hand on
riscv64-elf, we get the following error:

    (gdb) call pn(55)
    Could not compute alignment of type

The problem occurs because the parameter's type is a TYPE_CODE_RANGE,
and that type code is not handled by riscv_type_alignment. So this patch
fixes the issue by handling TYPE_CODE_RANGE the same way we handle other
integral types.

gdb/ChangeLog:

        * gdb/riscv-rdep.c (riscv_type_alignment): Handle TYPE_CODE_RANGE.

Tested on riscv64-elf using AdaCore's testsuite.
OK to apply?

Thanks,
-- 
Joel

---
 gdb/riscv-tdep.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index fb5e2c5..3e8f564 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -1632,6 +1632,7 @@ riscv_type_alignment (struct type *t)
     default:
       error (_("Could not compute alignment of type"));
 
+    case TYPE_CODE_RANGE:
     case TYPE_CODE_RVALUE_REF:
     case TYPE_CODE_PTR:
     case TYPE_CODE_ENUM:
-- 
2.1.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-02-19 14:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-10 13:38 [RFA] (riscv/ada) fix error when calling functions with range argument Joel Brobecker
2019-02-12 13:29 ` Andrew Burgess
2019-02-14  3:39   ` Joel Brobecker
2019-02-12 16:54 ` Tom Tromey
2019-02-12 21:17   ` Tom Tromey
2019-02-14  3:23     ` Joel Brobecker
2019-02-17 12:47       ` Joel Brobecker
2019-02-17 14:26         ` Tom Tromey
2019-02-17 15:09           ` Joel Brobecker
2019-02-18 23:39           ` Andrew Burgess
2019-02-19 14:16             ` Tom Tromey
2019-02-13 10:31   ` Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).