This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/simtrace2/+/24510 )
Change subject: assert: Use printf_sync() to ensure printing of assert / panic
......................................................................
assert: Use printf_sync() to ensure printing of assert / panic
Change-Id: Icc202e60445d9be1cdcd61176db5ed1704d583e7
---
M firmware/libcommon/include/assert.h
M firmware/libosmocore/source/panic.c
M firmware/test/card_emu_tests.c
3 files changed, 16 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/10/24510/1
diff --git a/firmware/libcommon/include/assert.h b/firmware/libcommon/include/assert.h
index 22bb101..dc6b1b5 100644
--- a/firmware/libcommon/include/assert.h
+++ b/firmware/libcommon/include/assert.h
@@ -89,7 +89,7 @@
/// \param condition Condition to verify.
#define ASSERT(condition) { \
if (!(condition)) { \
- printf("-F- ASSERT: %s %s:%d\n\r", #condition, __BASE_FILE__, __LINE__); \
+ printf_sync("-F- ASSERT: %s %s:%d\n\r", #condition, __BASE_FILE__, __LINE__); \
while (1); \
} \
}
diff --git a/firmware/libosmocore/source/panic.c b/firmware/libosmocore/source/panic.c
index 74243b0..db5c26a 100644
--- a/firmware/libosmocore/source/panic.c
+++ b/firmware/libosmocore/source/panic.c
@@ -46,7 +46,7 @@
__attribute__ ((format (printf, 1, 0)))
static void osmo_panic_default(const char *fmt, va_list args)
{
- vfprintf(stderr, fmt, args);
+ vfprintf_sync(stderr, fmt, args);
osmo_generate_backtrace();
assert(0);
}
diff --git a/firmware/test/card_emu_tests.c b/firmware/test/card_emu_tests.c
index 69159a8..5d5bd3e 100644
--- a/firmware/test/card_emu_tests.c
+++ b/firmware/test/card_emu_tests.c
@@ -13,6 +13,20 @@
#define PHONE_INT 2
#define PHONE_DATAOUT 3
+/* stub for stdio */
+signed int printf_sync(const char *pFormat, ...)
+{
+ va_list ap;
+ signed int result;
+
+ va_start(ap, pFormat);
+ result = vprintf(pFormat, ap);
+ va_end(ap);
+
+ return result;
+}
+
+
/***********************************************************************
* stub functions required by card_emu.c
***********************************************************************/
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/24510
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: Icc202e60445d9be1cdcd61176db5ed1704d583e7
Gerrit-Change-Number: 24510
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210602/ad8d7d4d/attachment.htm>