Skip to content

Commit 4f4b39c

Browse files
committed
llext: (cosmetic) add extension name and allocated size to debug message
Adding this information allows easy cross-reference of the effects of memory optimization changes between subsequent commits. To support it, the name needs to be filled in the 'llext' structure before the 'do_llext_load' function is called. Signed-off-by: Luca Burelli <[email protected]>
1 parent 6fd80ee commit 4f4b39c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

subsys/llext/llext.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,17 +160,17 @@ int llext_load(struct llext_loader *ldr, const char *name, struct llext **ext,
160160
goto out;
161161
}
162162

163+
strncpy((*ext)->name, name, sizeof((*ext)->name));
164+
(*ext)->name[sizeof((*ext)->name) - 1] = '\0';
165+
163166
ret = do_llext_load(ldr, *ext, ldr_parm);
164167
if (ret < 0) {
165168
llext_free(*ext);
166169
*ext = NULL;
167170
goto out;
168171
}
169172

170-
strncpy((*ext)->name, name, sizeof((*ext)->name));
171-
(*ext)->name[sizeof((*ext)->name) - 1] = '\0';
172173
(*ext)->use_count++;
173-
174174
sys_slist_append(&_llext_list, &(*ext)->_llext_list);
175175
LOG_INF("Loaded extension %s", (*ext)->name);
176176

subsys/llext/llext_load.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,8 @@ int do_llext_load(struct llext_loader *ldr, struct llext *ext,
762762
ext->exp_tab.sym_cnt = 0;
763763
ext->exp_tab.syms = NULL;
764764
} else {
765-
LOG_DBG("loaded module, .text at %p, .rodata at %p", ext->mem[LLEXT_MEM_TEXT],
765+
LOG_DBG("Loaded extension %s: %zu bytes in heap, .text at %p, .rodata at %p",
766+
ext->name, ext->alloc_size, ext->mem[LLEXT_MEM_TEXT],
766767
ext->mem[LLEXT_MEM_RODATA]);
767768
}
768769

0 commit comments

Comments
 (0)