Return region tag in mem_debug_malloc_dump()

Also in mem_init_dog() avoid making a byte access to the task name in
the debug block because that fails for the IRAM heap region.
This commit is contained in:
Stephen Casner 2017-10-22 00:25:10 -07:00
parent 241ecad44e
commit 88ab5d4830
2 changed files with 7 additions and 3 deletions

View file

@ -86,6 +86,7 @@ size_t mem_debug_malloc_dump(int task, mem_dump_block_t* buffer, size_t size)
*(int*)buffer->task = btask;
buffer->address = (void*)b;
buffer->size = b->size;
buffer->xtag = b->xtag;
++buffer;
--remaining;
b = b->next;
@ -132,8 +133,9 @@ void mem_init_dog(void *data)
#if (INCLUDE_pcTaskGetTaskName == 1)
task = xTaskGetCurrentTaskHandle();
if (task){
strncpy(b->head.task, pcTaskGetTaskName(task), 3);
b->head.task[3] = '\0';
int name = 0;
strncpy((char*)&name, pcTaskGetTaskName(task), 3);
*(int*)b->head.task = name;
}
else {
*(int*)b->head.task = 0;

View file

@ -78,7 +78,9 @@ extern void mem_malloc_set_abort(int task, int size, int count);
typedef struct {
char task[4];
void* address;
int size;
int size: 24; /*<< The size of the free block. */
int xtag: 7; /*<< Tag of this region */
int xAllocated: 1; /*<< 1 if allocated */
} mem_dump_block_t;
extern size_t mem_debug_malloc_dump(int task, mem_dump_block_t* buffer, size_t size);