Skip to content

Commit

Permalink
task: use get_task_name where possible
Browse files Browse the repository at this point in the history
Signed-off-by: xuxingliang <[email protected]>
  • Loading branch information
XuNeo committed Oct 1, 2024
1 parent 7acb298 commit f26c708
Show file tree
Hide file tree
Showing 24 changed files with 118 additions and 287 deletions.
24 changes: 11 additions & 13 deletions arch/arm/include/cxd56xx/crashdump.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,17 @@ typedef enum

typedef struct
{
struct timespec ts; /* timestamp */
fault_flags_t flags; /* What is in the dump */
uintptr_t current_regs; /* Used to validate the dump */
int lineno; /* __LINE__ to up_assert */
pid_t pid; /* Process ID */
uint32_t regs[XCPTCONTEXT_REGS]; /* Interrupt register save area */
crash_stack_t stacks; /* Stack info */
#if CONFIG_TASK_NAME_SIZE > 0
char name[CONFIG_TASK_NAME_SIZE + 1]; /* Task name (with NULL
* terminator) */
#endif
char filename[MAX_FILE_PATH_LENGTH]; /* the Last of chars in
* __FILE__ to up_assert */
struct timespec ts; /* timestamp */
fault_flags_t flags; /* What is in the dump */
uintptr_t current_regs; /* Used to validate the dump */
int lineno; /* __LINE__ to up_assert */
pid_t pid; /* Process ID */
uint32_t regs[XCPTCONTEXT_REGS]; /* Interrupt register save area */
crash_stack_t stacks; /* Stack info */
char name[CONFIG_TASK_NAME_SIZE + 1]; /* Task name (with NULL
* terminator) */
char filename[MAX_FILE_PATH_LENGTH]; /* the Last of chars in
* __FILE__ to up_assert */
} info_t;

typedef struct
Expand Down
13 changes: 3 additions & 10 deletions arch/risc-v/src/bl602/bl602_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,28 +99,21 @@ __cyg_profile_func_enter(void *this_fn, void *call_site)

if (sp < stack_base)
{
#if CONFIG_TASK_NAME_SIZE > 0
struct tcb_s *rtcb;
#endif

__asm volatile("csrc mstatus, 8");
__asm__("li s11, 0");

#if CONFIG_TASK_NAME_SIZE > 0
/* get current task */

rtcb = running_task();

syslog(LOG_EMERG,
"task %s stack overflow detected! base:0x%x >= sp:0x%x\n",
rtcb->name,
stack_base,
sp);
#else
syslog(LOG_EMERG,
"stack overflow detected! base:0x%x >= sp:0x%x\n",
get_task_name(rtcb),
stack_base,
sp);
#endif

/* PANIC(); */

while (1)
Expand Down
7 changes: 2 additions & 5 deletions arch/risc-v/src/common/riscv_exception.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,8 @@ int riscv_exception(int mcause, void *regs, void *args)
#ifdef CONFIG_ARCH_KERNEL_STACK
if ((tcb->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL)
{
# if CONFIG_TASK_NAME_SIZE > 0
_alert("Segmentation fault in PID %d: %s\n", tcb->pid, tcb->name);
# else
_alert("Segmentation fault in PID %d\n", tcb->pid);
# endif
_alert("Segmentation fault in PID %d: %s\n",
tcb->pid, get_task_name(tcb));

tcb->flags |= TCB_FLAG_FORCED_CANCEL;

Expand Down
13 changes: 3 additions & 10 deletions arch/xtensa/src/common/xtensa_assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,8 @@ void xtensa_panic(int xptcode, uint32_t *regs)

syslog_flush();

#if CONFIG_TASK_NAME_SIZE > 0
_alert("Unhandled Exception %d task: %s\n", xptcode, running_task()->name);
#else
_alert("Unhandled Exception %d\n", xptcode);
#endif
_alert("Unhandled Exception %d task: %s\n", xptcode,
get_task_name(running_task()));

PANIC_WITH_REGS("panic", regs); /* Should not return */
for (; ; );
Expand Down Expand Up @@ -177,12 +174,8 @@ void xtensa_user_panic(int exccause, uint32_t *regs)

syslog_flush();

#if CONFIG_TASK_NAME_SIZE > 0
_alert("User Exception: EXCCAUSE=%04x task: %s\n",
exccause, running_task()->name);
#else
_alert("User Exception: EXCCAUSE=%04x\n", exccause);
#endif
exccause, get_task_name(running_task()));

PANIC_WITH_REGS("user panic", regs); /* Should not return */
for (; ; );
Expand Down
4 changes: 2 additions & 2 deletions binfmt/libelf/libelf_coredump.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,11 @@ static void elf_emit_tcb_note(FAR struct elf_dumpinfo_s *cinfo,

elf_emit(cinfo, &nhdr, sizeof(nhdr));

strlcpy(name, tcb->name, sizeof(name));
strlcpy(name, get_task_name(tcb), sizeof(name));
elf_emit(cinfo, name, sizeof(name));

info.pr_pid = tcb->pid;
strlcpy(info.pr_fname, tcb->name, sizeof(info.pr_fname));
strlcpy(info.pr_fname, get_task_name(tcb), sizeof(info.pr_fname));
elf_emit(cinfo, &info, sizeof(info));

/* Fill Process status */
Expand Down
4 changes: 1 addition & 3 deletions boards/arm/cxd56xx/common/src/cxd56_crashdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,7 @@ void board_crashdump(uintptr_t sp, struct tcb_s *tcb,

/* Save Context */

#if CONFIG_TASK_NAME_SIZE > 0
strlcpy(pdump->info.name, tcb->name, sizeof(pdump->info.name));
#endif
strlcpy(pdump->info.name, get_task_name(tcb), sizeof(pdump->info.name));

pdump->info.pid = tcb->pid;

Expand Down
26 changes: 11 additions & 15 deletions boards/arm/stm32/nucleo-f429zi/src/stm32_bbsram.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,18 +232,16 @@ typedef enum

typedef struct
{
fault_flags_t flags; /* What is in the dump */
uintptr_t current_regs; /* Used to validate the dump */
int lineno; /* __LINE__ to up_assert */
pid_t pid; /* Process ID */
uint32_t regs[XCPTCONTEXT_REGS]; /* Interrupt register save area */
stacks_t stacks; /* Stack info */
#if CONFIG_TASK_NAME_SIZE > 0
char name[CONFIG_TASK_NAME_SIZE + 1]; /* Task name (with NULL
* terminator) */
#endif
char filename[MAX_FILE_PATH_LENGTH]; /* the Last of chars in
* __FILE__ to up_assert */
fault_flags_t flags; /* What is in the dump */
uintptr_t current_regs; /* Used to validate the dump */
int lineno; /* __LINE__ to up_assert */
pid_t pid; /* Process ID */
uint32_t regs[XCPTCONTEXT_REGS]; /* Interrupt register save area */
stack_t stacks; /* Stack info */
char name[CONFIG_TASK_NAME_SIZE + 1]; /* Task name (with NULL
* terminator) */
char filename[MAX_FILE_PATH_LENGTH]; /* the Last of chars in
* __FILE__ to up_assert */
} info_t;

typedef struct
Expand Down Expand Up @@ -420,9 +418,7 @@ void board_crashdump(uintptr_t sp, struct tcb_s *tcb,

/* Save Context */

#if CONFIG_TASK_NAME_SIZE > 0
strlcpy(pdump->info.name, tcb->name, sizeof(pdump->info.name));
#endif
strlcpy(pdump->info.name, get_task_name(tcb), sizeof(pdump->info.name));

pdump->info.pid = tcb->pid;

Expand Down
26 changes: 11 additions & 15 deletions boards/arm/stm32f7/nucleo-144/src/stm32_bbsram.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,18 +232,16 @@ typedef enum

typedef struct
{
fault_flags_t flags; /* What is in the dump */
uintptr_t current_regs; /* Used to validate the dump */
int lineno; /* __LINE__ to up_assert */
int pid; /* Process ID */
uint32_t regs[XCPTCONTEXT_REGS]; /* Interrupt register save area */
stacks_t stacks; /* Stack info */
#if CONFIG_TASK_NAME_SIZE > 0
char name[CONFIG_TASK_NAME_SIZE + 1]; /* Task name (with NULL
* terminator) */
#endif
char filename[MAX_FILE_PATH_LENGTH]; /* the Last of chars in
* __FILE__ to up_assert */
fault_flags_t flags; /* What is in the dump */
uintptr_t current_regs; /* Used to validate the dump */
int lineno; /* __LINE__ to up_assert */
int pid; /* Process ID */
uint32_t regs[XCPTCONTEXT_REGS]; /* Interrupt register save area */
stack_t stacks; /* Stack info */
char name[CONFIG_TASK_NAME_SIZE + 1]; /* Task name (with NULL
* terminator) */
char filename[MAX_FILE_PATH_LENGTH]; /* the Last of chars in
* __FILE__ to up_assert */
} info_t;

typedef struct
Expand Down Expand Up @@ -420,9 +418,7 @@ void board_crashdump(uintptr_t sp, struct tcb_s *tcb,

/* Save Context */

#if CONFIG_TASK_NAME_SIZE > 0
strlcpy(pdump->info.name, tcb->name, sizeof(pdump->info.name));
#endif
strlcpy(pdump->info.name, get_task_name(tcb), sizeof(pdump->info.name));

pdump->info.pid = tcb->pid;

Expand Down
26 changes: 11 additions & 15 deletions boards/renesas/rx65n/rx65n-grrose/src/rx65n_sbram.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,16 @@ typedef enum

typedef struct
{
fault_flags_t flags; /* What is in the dump */
uintptr_t current_regs; /* Used to validate the dump */
int lineno; /* __LINE__ to up_assert */
pid_t pid; /* Process ID */
uint32_t regs[XCPTCONTEXT_REGS]; /* Interrupt register save area */
stack_t stacks; /* Stack info */
#if CONFIG_TASK_NAME_SIZE > 0
char name[CONFIG_TASK_NAME_SIZE + 1]; /* Task name (with NULL
* terminator) */
#endif
char filename[MAX_FILE_PATH_LENGTH]; /* the Last of chars in
* __FILE__ to up_assert */
fault_flags_t flags; /* What is in the dump */
uintptr_t current_regs; /* Used to validate the dump */
int lineno; /* __LINE__ to up_assert */
pid_t pid; /* Process ID */
uint32_t regs[XCPTCONTEXT_REGS]; /* Interrupt register save area */
stack_t stacks; /* Stack info */
char name[CONFIG_TASK_NAME_SIZE + 1]; /* Task name (with NULL
* terminator) */
char filename[MAX_FILE_PATH_LENGTH]; /* the Last of chars in
* __FILE__ to up_assert */
} info_t;

struct fullcontext
Expand Down Expand Up @@ -374,9 +372,7 @@ void board_crashdump(uintptr_t sp, struct tcb_s *tcb,

/* Save Context */

#if CONFIG_TASK_NAME_SIZE > 0
strlcpy(pdump->info.name, tcb->name, sizeof(pdump->info.name));
#endif
strlcpy(pdump->info.name, get_task_name(tcb), sizeof(pdump->info.name));

pdump->info.pid = tcb->pid;

Expand Down
26 changes: 11 additions & 15 deletions boards/renesas/rx65n/rx65n-rsk2mb/src/rx65n_sbram.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,16 @@ typedef enum

typedef struct
{
fault_flags_t flags; /* What is in the dump */
uintptr_t current_regs; /* Used to validate the dump */
int lineno; /* __LINE__ to up_assert */
pid_t pid; /* Process ID */
uint32_t regs[XCPTCONTEXT_REGS]; /* Interrupt register save area */
stack_t stacks; /* Stack info */
#if CONFIG_TASK_NAME_SIZE > 0
char name[CONFIG_TASK_NAME_SIZE + 1]; /* Task name (with NULL
* terminator) */
#endif
char filename[MAX_FILE_PATH_LENGTH]; /* the Last of chars in
* __FILE__ to up_assert */
fault_flags_t flags; /* What is in the dump */
uintptr_t current_regs; /* Used to validate the dump */
int lineno; /* __LINE__ to up_assert */
pid_t pid; /* Process ID */
uint32_t regs[XCPTCONTEXT_REGS]; /* Interrupt register save area */
stack_t stacks; /* Stack info */
char name[CONFIG_TASK_NAME_SIZE + 1]; /* Task name (with NULL
* terminator) */
char filename[MAX_FILE_PATH_LENGTH]; /* the Last of chars in
* __FILE__ to up_assert */
} info_t;

struct fullcontext
Expand Down Expand Up @@ -372,9 +370,7 @@ void board_crashdump(uintptr_t sp, struct tcb_s *tcb,

/* Save Context */

#if CONFIG_TASK_NAME_SIZE > 0
strlcpy(pdump->info.name, tcb->name, sizeof(pdump->info.name));
#endif
strlcpy(pdump->info.name, get_task_name(tcb), sizeof(pdump->info.name));

pdump->info.pid = tcb->pid;

Expand Down
1 change: 0 additions & 1 deletion drivers/note/note_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -2007,4 +2007,3 @@ int note_driver_register(FAR struct note_driver_s *driver)

return -ENOMEM;
}

Loading

0 comments on commit f26c708

Please sign in to comment.