mirror of https://gerrit.osmocom.org/simtrace2
implement minimalistic talloc_report(); add 't' command on UART
This helps when debugging the firmware, as it shows the current utliization of the 10-msgb-talloc pool. Change-Id: Ib10c4396cd4c9c4a6257cf45886e367214787927 Related: OS#4251
This commit is contained in:
parent
7c1d85eb4d
commit
63c9e1f402
|
@ -230,6 +230,7 @@ void board_exec_dbg_cmd(int ch)
|
|||
printf("\t2\tGenerate 1ms reset pulse on WWAN2\n\r");
|
||||
printf("\t!\tSwitch Channel A from physical -> remote\n\r");
|
||||
printf("\t@\tSwitch Channel B from physical -> remote\n\r");
|
||||
printf("\tt\t(pseudo)talloc report\n\r");
|
||||
break;
|
||||
case 'R':
|
||||
printf("Asking NVIC to reset us\n\r");
|
||||
|
@ -292,6 +293,9 @@ void board_exec_dbg_cmd(int ch)
|
|||
case '@':
|
||||
sim_switch_use_physical(0, 0);
|
||||
break;
|
||||
case 't':
|
||||
talloc_report(NULL, stdout);
|
||||
break;
|
||||
default:
|
||||
if (!qmod_sam3_is_12())
|
||||
printf("Unknown command '%c'\n\r", ch);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
/* minimalistic emulation of core talloc API functions used by msgb.c */
|
||||
|
@ -39,3 +40,4 @@ void *talloc_named_const(const void *context, size_t size, const char *name);
|
|||
void talloc_set_name_const(const void *ptr, const char *name);
|
||||
char *talloc_strdup(const void *t, const char *p);
|
||||
void *talloc_pool(const void *context, size_t size);
|
||||
void talloc_report(const void *ptr, FILE *f);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "talloc.h"
|
||||
#include "trace.h"
|
||||
|
@ -76,6 +77,20 @@ int _talloc_free(void *ptr, const char *location)
|
|||
return -1;
|
||||
}
|
||||
|
||||
void talloc_report(const void *ptr, FILE *f)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
fprintf(f, "talloc_report(): ");
|
||||
for (i = 0; i < ARRAY_SIZE(msgb_inuse); i++) {
|
||||
if (msgb_inuse[i])
|
||||
fputc('X', f);
|
||||
else
|
||||
fputc('_', f);
|
||||
}
|
||||
fprintf(f, "\r\n");
|
||||
}
|
||||
|
||||
void talloc_set_name_const(const void *ptr, const char *name)
|
||||
{
|
||||
/* do nothing */
|
||||
|
|
Loading…
Reference in New Issue