* [PATCH 0/2] fix ARI warnings for RISC-V port and fallout
@ 2019-10-10 23:54 Jim Wilson
2019-10-10 23:55 ` [PATCH 2/2] Improve comments in print-utils.h Jim Wilson
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jim Wilson @ 2019-10-10 23:54 UTC (permalink / raw)
To: gdb-patches; +Cc: Jim Wilson
The first patch fixes the RISC-V ARI warnings reported in July. The
second patch fixes problems with the print-utils.h function comments I
noticed because I had to figure out what they did to write the first
patch.
This was tested with a riscv64-linux build and check, with no
regressions. I also tested gdb by hand to verify that the debugging
comment was still correct after the change as there is no testcase for
that.
Jim
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] Improve comments in print-utils.h.
2019-10-10 23:54 [PATCH 0/2] fix ARI warnings for RISC-V port and fallout Jim Wilson
@ 2019-10-10 23:55 ` Jim Wilson
2019-10-10 23:55 ` [PATCH 1/2] RISC-V: Fix two ARI warnings Jim Wilson
2019-10-11 13:15 ` [PATCH 0/2] fix ARI warnings for RISC-V port and fallout Tom Tromey
2 siblings, 0 replies; 4+ messages in thread
From: Jim Wilson @ 2019-10-10 23:55 UTC (permalink / raw)
To: gdb-patches; +Cc: Jim Wilson
Since I had to look at these function comments to fix the RISC-V ARI warnings,
I noticed that they make no sense. The pulongest and plongest comments are
swapped. phex is missing a comment. And phex_nz doesn't mention how it is
different from phex.
* gdbsupport/print-utils.h (pulongest): Fix comment.
(plongest): Likewise.
(phex): Add missing comment, mention leading zeros.
(phex_nz): Add mention of no leading zeros to comment.
---
gdb/gdbsupport/print-utils.h | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/gdb/gdbsupport/print-utils.h b/gdb/gdbsupport/print-utils.h
index 815b14cbed..d52bcf8f61 100644
--- a/gdb/gdbsupport/print-utils.h
+++ b/gdb/gdbsupport/print-utils.h
@@ -24,20 +24,23 @@
cell. */
#define PRINT_CELL_SIZE 50
-/* %d for LONGEST. The result is stored in a circular static buffer,
+/* %u for ULONGEST. The result is stored in a circular static buffer,
NUMCELLS deep. */
extern char *pulongest (ULONGEST u);
-/* %u for ULONGEST. The result is stored in a circular static buffer,
+/* %d for LONGEST. The result is stored in a circular static buffer,
NUMCELLS deep. */
extern char *plongest (LONGEST l);
+/* Convert a ULONGEST into a HEX string, like %lx, with leading zeros.
+ The result is stored in a circular static buffer, NUMCELLS deep. */
+
extern char *phex (ULONGEST l, int sizeof_l);
-/* Convert a ULONGEST into a HEX string, like %lx. The result is
- stored in a circular static buffer, NUMCELLS deep. */
+/* Convert a ULONGEST into a HEX string, like %lx, without leading zeros.
+ The result is stored in a circular static buffer, NUMCELLS deep. */
extern char *phex_nz (ULONGEST l, int sizeof_l);
--
2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] RISC-V: Fix two ARI warnings.
2019-10-10 23:54 [PATCH 0/2] fix ARI warnings for RISC-V port and fallout Jim Wilson
2019-10-10 23:55 ` [PATCH 2/2] Improve comments in print-utils.h Jim Wilson
@ 2019-10-10 23:55 ` Jim Wilson
2019-10-11 13:15 ` [PATCH 0/2] fix ARI warnings for RISC-V port and fallout Tom Tromey
2 siblings, 0 replies; 4+ messages in thread
From: Jim Wilson @ 2019-10-10 23:55 UTC (permalink / raw)
To: gdb-patches; +Cc: Jim Wilson
> gdb/riscv-tdep.c:1657: code: %ll: Do not use printf(%ll), instead use printf(%s,phex()) to dump a 'long long' value
gdb/riscv-tdep.c:1657: "Writing %lld-byte nop instruction to %s: %s\n",
> gdb/riscv-tdep.c:1658: code: long long: Do not use 'long long', instead use LONGEST
gdb/riscv-tdep.c:1658: ((unsigned long long) sizeof (nop_insn)),
fprintf_unfiltered doesn't support z (or j for that matter), and fixing that
is a larger patch than I'd like to write, so this does basically what the
ARI warnings recommends. We don't need the cast as there is a prototype for
plongest.
* riscv-tdep.c (riscv_push_dummy_code): Change %lld to %s and use
plongest instead of unsigned long long cast.
---
gdb/riscv-tdep.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index e4a66f1429..003b230fcf 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -1654,8 +1654,8 @@ riscv_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp,
if (riscv_debug_breakpoints || riscv_debug_infcall)
fprintf_unfiltered (gdb_stdlog,
- "Writing %lld-byte nop instruction to %s: %s\n",
- ((unsigned long long) sizeof (nop_insn)),
+ "Writing %s-byte nop instruction to %s: %s\n",
+ plongest (sizeof (nop_insn)),
paddress (gdbarch, *bp_addr),
(status == 0 ? "success" : "failed"));
--
2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] fix ARI warnings for RISC-V port and fallout
2019-10-10 23:54 [PATCH 0/2] fix ARI warnings for RISC-V port and fallout Jim Wilson
2019-10-10 23:55 ` [PATCH 2/2] Improve comments in print-utils.h Jim Wilson
2019-10-10 23:55 ` [PATCH 1/2] RISC-V: Fix two ARI warnings Jim Wilson
@ 2019-10-11 13:15 ` Tom Tromey
2 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2019-10-11 13:15 UTC (permalink / raw)
To: Jim Wilson; +Cc: gdb-patches
>>>>> "Jim" == Jim Wilson <jimw@sifive.com> writes:
Jim> The first patch fixes the RISC-V ARI warnings reported in July. The
Jim> second patch fixes problems with the print-utils.h function comments I
Jim> noticed because I had to figure out what they did to write the first
Jim> patch.
Jim> This was tested with a riscv64-linux build and check, with no
Jim> regressions. I also tested gdb by hand to verify that the debugging
Jim> comment was still correct after the change as there is no testcase for
Jim> that.
I read these and they look fine to me. Thanks for doing this.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-11 13:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10 23:54 [PATCH 0/2] fix ARI warnings for RISC-V port and fallout Jim Wilson
2019-10-10 23:55 ` [PATCH 2/2] Improve comments in print-utils.h Jim Wilson
2019-10-10 23:55 ` [PATCH 1/2] RISC-V: Fix two ARI warnings Jim Wilson
2019-10-11 13:15 ` [PATCH 0/2] fix ARI warnings for RISC-V port and fallout Tom Tromey
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).