Change in osmo-ccid-firmware[master]: some basic talloc related vty commands

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat May 11 18:19:47 UTC 2019


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/13995


Change subject: some basic talloc related vty commands
......................................................................

some basic talloc related vty commands

Change-Id: Id7c99e0c1d6b7421667425d38b512ad959142132
---
M sysmoOCTSIM/main.c
1 file changed, 27 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/95/13995/1

diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c
index 6178f50..c2a959b 100644
--- a/sysmoOCTSIM/main.c
+++ b/sysmoOCTSIM/main.c
@@ -708,6 +708,26 @@
 
 extern void testmode_init(void);
 
+#include "talloc.h"
+void *g_tall_ctx;
+
+DEFUN(_talloc_report, cmd_talloc_report, "talloc-report", "Generate a talloc report")
+{
+	talloc_report_full(g_tall_ctx, stdout);
+}
+
+DEFUN(talloc_test, cmd_talloc_test, "talloc-test", "Test the talloc allocator")
+{
+	for (int i = 0; i < 10; i++)
+		talloc_named_const(g_tall_ctx, 10, "sibling");
+}
+
+DEFUN(v_talloc_free, cmd_talloc_free, "talloc-free", "Release all memory")
+{
+	talloc_free(g_tall_ctx);
+	g_tall_ctx = NULL;
+}
+
 /* Section 9.6 of SAMD5x/E5x Family Data Sheet */
 static int get_chip_unique_serial(uint8_t *out, size_t len)
 {
@@ -759,10 +779,17 @@
 	command_register(&cmd_sim_atr);
 	command_register(&cmd_sim_iccid);
 	testmode_init();
+	command_register(&cmd_talloc_test);
+	command_register(&cmd_talloc_report);
+	command_register(&cmd_talloc_free);
 
 	printf("\r\n\r\nsysmocom sysmoOCTSIM\r\n");
 	printf("Chip-Id %s\r\n", sernr_buf);
 
+	talloc_enable_null_tracking();
+	g_tall_ctx = talloc_named_const(NULL, 0, "global");
+	printf("g_tall_ctx=%p\r\n", g_tall_ctx);
+
 	command_print_prompt();
 	while (true) { // main loop
 		command_try_recv();

-- 
To view, visit https://gerrit.osmocom.org/13995
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id7c99e0c1d6b7421667425d38b512ad959142132
Gerrit-Change-Number: 13995
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190511/444e25c2/attachment.htm>


More information about the gerrit-log mailing list