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

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


Harald Welte has submitted this change and it was merged. ( 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(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c
index 6ab8bc8..6381a80 100644
--- a/sysmoOCTSIM/main.c
+++ b/sysmoOCTSIM/main.c
@@ -707,6 +707,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;
+}
+
 int main(void)
 {
 	atmel_start_init();
@@ -724,9 +744,16 @@
 	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");
 
+	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: merged
Gerrit-Change-Id: Id7c99e0c1d6b7421667425d38b512ad959142132
Gerrit-Change-Number: 13995
Gerrit-PatchSet: 2
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190511/f55db1a4/attachment.html>


More information about the gerrit-log mailing list