From 378102fb60946fd240b63cad37e2126c86805310 Mon Sep 17 00:00:00 2001 From: "Jonathan Pallant (Ferrous Systems)" Date: Wed, 8 Mar 2023 10:59:57 +0000 Subject: [PATCH 1/3] Add 0x prefix onto defmt'd pointers. Fixes #603 --- defmt/src/impls/primitives.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defmt/src/impls/primitives.rs b/defmt/src/impls/primitives.rs index 09006763..4c62a9e9 100644 --- a/defmt/src/impls/primitives.rs +++ b/defmt/src/impls/primitives.rs @@ -78,7 +78,7 @@ where T: ?Sized, { fn format(&self, fmt: Formatter) { - crate::write!(fmt, "{:x}", *self as *const () as usize); + crate::write!(fmt, "0x{:x}", *self as *const () as usize); } } From f3d7761183cef23704a40d74099959d82370a26a Mon Sep 17 00:00:00 2001 From: "Jonathan Pallant (Ferrous Systems)" Date: Wed, 8 Mar 2023 12:06:50 +0000 Subject: [PATCH 2/3] Update CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77a8b3a0..201c47ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] - [#733]: `defmt`: Add formatting for `core::net` with the `ip_in_core` feature +- [#603]: `defmt`: Raw pointers now print as `0x1234` instead of `1234` [#733]: https://github.com/knurling-rs/defmt/pull/733 +[#603]: https://github.com/knurling-rs/defmt/pull/734 ## defmt-decoder v0.3.4, defmt-print v0.3.4 From 6060d99efd504f93a5df773ffaf2f33b27a6666e Mon Sep 17 00:00:00 2001 From: "Jonathan Pallant (Ferrous Systems)" Date: Wed, 8 Mar 2023 14:41:20 +0000 Subject: [PATCH 3/3] Modify expected QEMU output. Pointers now have 0x on them. --- firmware/qemu/src/bin/log.out | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/firmware/qemu/src/bin/log.out b/firmware/qemu/src/bin/log.out index 36b7b409..0e7cdcb0 100644 --- a/firmware/qemu/src/bin/log.out +++ b/firmware/qemu/src/bin/log.out @@ -122,8 +122,8 @@ INFO b"Hi" INFO [45054, 49406] INFO [Data { name: b"Hi", value: true }] INFO true true -INFO aabbccdd -INFO ddccbbaa +INFO 0xaabbccdd +INFO 0xddccbbaa INFO 1..2 INFO 1.. INFO ..2 @@ -146,7 +146,7 @@ INFO 1 INFO 1 INFO 1 INFO 1 -INFO ccbbaadd +INFO 0xccbbaadd INFO log data: 43981 INFO flush! 🚽 INFO log more data! 🎉