Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/21459 )
Change subject: base: Ensure %p format arguments are printed as pointers.
......................................................................
base: Ensure %p format arguments are printed as pointers.
If the %p format is used, char * arguments should be printed as the
hex value of their pointer, not as strings. Unfortunately blindly
passing them to an ostream using << will not do that. This change adds
some casting in that case to ensure that they're treated as numbers and
not as strings.
Change-Id: If02bae6d5e468b352266702fcba62b6beddffcbd
---
M src/base/cprintf_formats.hh
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/base/cprintf_formats.hh b/src/base/cprintf_formats.hh
index f55fb95..cca41e9 100644
--- a/src/base/cprintf_formats.hh
+++ b/src/base/cprintf_formats.hh
@@ -312,6 +312,12 @@
inline void
format_integer(std::ostream &out, signed char data, Format &fmt)
{ _format_integer(out, (int)data, fmt); }
+inline void
+format_integer(std::ostream &out, const unsigned char *data, Format &fmt)
+{ _format_integer(out, (uintptr_t)data, fmt); }
+inline void
+format_integer(std::ostream &out, const signed char *data, Format &fmt)
+{ _format_integer(out, (uintptr_t)data, fmt); }
//
// floating point formats
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/21459
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: If02bae6d5e468b352266702fcba62b6beddffcbd
Gerrit-Change-Number: 21459
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabebl...@google.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev