public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Hans-Peter Nilsson <hp@axis.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 01/12] sim cris: Correct PRIu32 to PRIx32
Date: Mon, 14 Feb 2022 23:59:52 +0100	[thread overview]
Message-ID: <20220214225952.DF9AD20439@pchp3.se.axis.com> (raw)

In 5ee0bc23a68f "sim: clean up bfd_vma printing" there was
an additional introduction of PRIx32 and PRIu32 but just in
sim/cris/sim-if.c.  One type of bug was fixed in commit
d16ce6e4d581 "sim: cris: fix memory setup typos" but one
remained; the PRIu32 usage is wrong, as hex output is
desired; note the 0x prefix.

Without this fix, you'll see output like:
 memory map 0:0x4000..0x5fff (8192 bytes) overlaps 0:0x0..0x16383 (91012 bytes)
 program stopped with signal 6 (Aborted).
for some C programs, like some of the ones in the sim/cris/c
testsuite from where the example is taken (freopen2.c).

The bug behavior was with memory allocation.  With an
attempt to allocate memory using the brk syscall such that
the room up to the next 8192-byte "page boundary" wasn't
sufficient, the simulator memory allocation machinery horked
on a consistency error when trying to allocate a memory
block to raise the "end of the data segment": there was
already memory allocated at that address.

Unfortunately, none of the programs in sim/cris/asm exposed
this bug at the time, but an assembler test-case is
committed after this fix.

sim/cris:
	* sim-if.c (sim_open): Correct PRIu32 to PRIx32.
---
 sim/cris/sim-if.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sim/cris/sim-if.c b/sim/cris/sim-if.c
index 602db9aebf4b..63deb467bc07 100644
--- a/sim/cris/sim-if.c
+++ b/sim/cris/sim-if.c
@@ -887,7 +887,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
 
   /* Allocate core managed memory if none specified by user.  */
   if (sim_core_read_buffer (sd, NULL, read_map, &c, startmem, 1) == 0)
-    sim_do_commandf (sd, "memory region 0x%" PRIx32 ",0x%" PRIu32,
+    sim_do_commandf (sd, "memory region 0x%" PRIx32 ",0x%" PRIx32,
 		     startmem, endmem - startmem);
 
   /* Allocate simulator I/O managed memory if none specified by user.  */
-- 
2.30.2


         reply	other threads:[~2022-02-14 22:59 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14 22:58 [PATCH 00/12] A little TLC for the simulators (in particular CRIS) Hans-Peter Nilsson
2022-02-14 22:59 ` Hans-Peter Nilsson [this message]
2022-02-16  4:43   ` [PATCH 01/12] sim cris: Correct PRIu32 to PRIx32 Mike Frysinger
2022-02-14 23:02 ` [PATCH 03/12] sim/testsuite: Set global_cc_os also when no compiler is found Hans-Peter Nilsson
2022-02-16  4:42   ` Mike Frysinger
2022-02-14 23:02 ` [PATCH 04/12] sim/testsuite/cris/c: Use -sim3 but only for newlib targets Hans-Peter Nilsson
2022-02-15 17:43   ` Dimitar Dimitrov
2022-02-15 22:49     ` Hans-Peter Nilsson
2022-02-16  5:25   ` Mike Frysinger
2022-02-16  6:07     ` Hans-Peter Nilsson
2022-02-16  7:34       ` Mike Frysinger
2022-02-16  5:39   ` Mike Frysinger
2022-02-16  6:09     ` Hans-Peter Nilsson
2022-02-16  7:17       ` Mike Frysinger
2022-02-16 15:27         ` Hans-Peter Nilsson
2022-02-14 23:03 ` [PATCH 06/12] sim/testsuite: Support "requires: simoption <--name-of-option>" Hans-Peter Nilsson
2022-02-16  4:49   ` Mike Frysinger
2022-02-16  6:24     ` Hans-Peter Nilsson
2022-02-16  7:09       ` Mike Frysinger
2022-02-16 15:25         ` Hans-Peter Nilsson
2022-02-14 23:05 ` [PATCH 08/12] sim cris: Unbreak --disable-sim-hardware builds Hans-Peter Nilsson
2022-02-16  4:51   ` Mike Frysinger
2022-02-16  5:54     ` Hans-Peter Nilsson
2022-02-16  6:48       ` Hans-Peter Nilsson
2022-02-16  7:15       ` Mike Frysinger
2022-02-14 23:05 ` [PATCH 09/12] sim: Fix use of out-of-tree assembler and linker when testing Hans-Peter Nilsson
2022-02-16  5:03   ` Mike Frysinger
2022-02-14 23:06 ` [PATCH 10/12] sim: Add sim_dump_memory for debugging Hans-Peter Nilsson
2022-02-16  5:02   ` Mike Frysinger
2022-02-16  6:10     ` Hans-Peter Nilsson
2022-02-16  6:41     ` Hans-Peter Nilsson
2022-02-17  2:05     ` Hans-Peter Nilsson
2022-02-17  5:30       ` Mike Frysinger
2022-02-14 23:07 ` [PATCH 11/12] sim/testsuite/cris: Remove faulty use of basename in C tests Hans-Peter Nilsson
2022-02-16  4:57   ` Mike Frysinger
2022-02-16  6:44     ` Hans-Peter Nilsson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220214225952.DF9AD20439@pchp3.se.axis.com \
    --to=hp@axis.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).