mirror of
https://git.rtems.org/rtems-tools/
synced 2025-10-19 01:49:03 +08:00
rtems-tld: Add a printk generator.
This commit is contained in:
@@ -15,20 +15,20 @@ generator = printf-generator
|
|||||||
;
|
;
|
||||||
[printf-generator]
|
[printf-generator]
|
||||||
headers = printf-generator-headers
|
headers = printf-generator-headers
|
||||||
entry-trace = "rtld_pg_print_entry(@FUNC_NAME@, (void*) &@FUNC_LABEL@);"
|
entry-trace = "rtld_pg_printf_entry(@FUNC_NAME@, (void*) &@FUNC_LABEL@);"
|
||||||
arg-trace = "rtld_pg_print_arg(@ARG_NUM@, @ARG_TYPE@, @ARG_SIZE@, (void*) &@ARG_LABEL@);"
|
arg-trace = "rtld_pg_printf_arg(@ARG_NUM@, @ARG_TYPE@, @ARG_SIZE@, (void*) &@ARG_LABEL@);"
|
||||||
exit-trace = "rtld_pg_print_exit(@FUNC_NAME@, (void*) &@FUNC_LABEL@);"
|
exit-trace = "rtld_pg_printf_exit(@FUNC_NAME@, (void*) &@FUNC_LABEL@);"
|
||||||
ret-trace = "rtld_pg_print_ret(@RET_TYPE@, @RET_SIZE@, (void*) &@RET_LABEL@);"
|
ret-trace = "rtld_pg_printf_ret(@RET_TYPE@, @RET_SIZE@, (void*) &@RET_LABEL@);"
|
||||||
code = <<<CODE
|
code = <<<CODE
|
||||||
static inline void rtld_pg_print_entry(const char* func_name,
|
static inline void rtld_pg_printf_entry(const char* func_name,
|
||||||
void* func_addr)
|
void* func_addr)
|
||||||
{
|
{
|
||||||
printf (" >> %s (0x%08x)\n", func_name, func_addr);
|
printf (" >> %s (0x%08x)\n", func_name, func_addr);
|
||||||
}
|
}
|
||||||
static inline void rtld_pg_print_arg(int arg_num,
|
static inline void rtld_pg_printf_arg(int arg_num,
|
||||||
const char* arg_type,
|
const char* arg_type,
|
||||||
int arg_size,
|
int arg_size,
|
||||||
void* arg)
|
void* arg)
|
||||||
{
|
{
|
||||||
const unsigned char* p = arg;
|
const unsigned char* p = arg;
|
||||||
int i;
|
int i;
|
||||||
@@ -36,14 +36,14 @@ static inline void rtld_pg_print_arg(int arg_num,
|
|||||||
for (i = 0; i < arg_size; ++i, ++p) printf ("%02x", (unsigned int) *p);
|
for (i = 0; i < arg_size; ++i, ++p) printf ("%02x", (unsigned int) *p);
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
}
|
}
|
||||||
static inline void rtld_pg_print_exit(const char* func_name,
|
static inline void rtld_pg_printf_exit(const char* func_name,
|
||||||
void* func_addr)
|
void* func_addr)
|
||||||
{
|
{
|
||||||
printf (" << %s (0x%08x)\n", func_name, func_addr);
|
printf (" << %s (0x%08x)\n", func_name, func_addr);
|
||||||
}
|
}
|
||||||
static inline void rtld_pg_print_ret(const char* ret_type,
|
static inline void rtld_pg_printf_ret(const char* ret_type,
|
||||||
int ret_size,
|
int ret_size,
|
||||||
void* ret)
|
void* ret)
|
||||||
{
|
{
|
||||||
const unsigned char* p = ret;
|
const unsigned char* p = ret;
|
||||||
int i;
|
int i;
|
||||||
@@ -55,3 +55,46 @@ CODE
|
|||||||
|
|
||||||
[printf-generator-headers]
|
[printf-generator-headers]
|
||||||
header = "#include <stdio.h>"
|
header = "#include <stdio.h>"
|
||||||
|
|
||||||
|
[printk-generator]
|
||||||
|
headers = printk-generator-headers
|
||||||
|
entry-trace = "rtld_pg_printk_entry(@FUNC_NAME@, (void*) &@FUNC_LABEL@);"
|
||||||
|
arg-trace = "rtld_pg_printk_arg(@ARG_NUM@, @ARG_TYPE@, @ARG_SIZE@, (void*) &@ARG_LABEL@);"
|
||||||
|
exit-trace = "rtld_pg_printk_exit(@FUNC_NAME@, (void*) &@FUNC_LABEL@);"
|
||||||
|
ret-trace = "rtld_pg_printk_ret(@RET_TYPE@, @RET_SIZE@, (void*) &@RET_LABEL@);"
|
||||||
|
code = <<<CODE
|
||||||
|
static inline void rtld_pg_printk_entry(const char* func_name,
|
||||||
|
void* func_addr)
|
||||||
|
{
|
||||||
|
printk (" >> %s (0x%08x)\n", func_name, func_addr);
|
||||||
|
}
|
||||||
|
static inline void rtld_pg_printk_arg(int arg_num,
|
||||||
|
const char* arg_type,
|
||||||
|
int arg_size,
|
||||||
|
void* arg)
|
||||||
|
{
|
||||||
|
const unsigned char* p = arg;
|
||||||
|
int i;
|
||||||
|
printk (" %2d] %s(%d) = ", arg_num, arg_type, arg_size);
|
||||||
|
for (i = 0; i < arg_size; ++i, ++p) printk ("%02x", (unsigned int) *p);
|
||||||
|
printk ("\n");
|
||||||
|
}
|
||||||
|
static inline void rtld_pg_printk_exit(const char* func_name,
|
||||||
|
void* func_addr)
|
||||||
|
{
|
||||||
|
printk (" << %s (0x%08x)\n", func_name, func_addr);
|
||||||
|
}
|
||||||
|
static inline void rtld_pg_printk_ret(const char* ret_type,
|
||||||
|
int ret_size,
|
||||||
|
void* ret)
|
||||||
|
{
|
||||||
|
const unsigned char* p = ret;
|
||||||
|
int i;
|
||||||
|
printk (" rt] %s(%d) = ", ret_type, ret_size);
|
||||||
|
for (i = 0; i < ret_size; ++i, ++p) printk ("%02x", (unsigned int) *p);
|
||||||
|
printk ("\n");
|
||||||
|
}
|
||||||
|
CODE
|
||||||
|
|
||||||
|
[printk-generator-headers]
|
||||||
|
header = "#include <stdio.h>"
|
||||||
|
Reference in New Issue
Block a user