Linux Kernel(4.19) Hacks

rousalome.egloos.com

포토로그 Kernel Crash


통계 위젯 (화이트)

132199
1107
135860


sample code palette

git clone --depth=1 https://github.com/raspberrypi/linux

>

#!/bin/bash
echo 0 > /sys/kernel/debug/tracing/tracing_on
echo "ftrace off"
sleep 3
cp /sys/kernel/debug/tracing/trace .
mv trace ftrace_log.c


>

#!/bin/bash

echo 0 > /sys/kernel/debug/tracing/tracing_on
sleep 1
echo "tracing_off"

echo 0 > /sys/kernel/debug/tracing/events/enable
sleep 1
echo "events disabled"

echo  secondary_start_kernel  > /sys/kernel/debug/tracing/set_ftrace_filter
sleep 1
echo "set_ftrace_filter init"

echo function > /sys/kernel/debug/tracing/current_tracer
sleep 1
echo "function tracer enabled"

echo _raw_spin_unlock_irqrestore  > /sys/kernel/debug/tracing/set_ftrace_filter
sleep 1
echo "set_ftrace_filter enabled"

echo 1 > /sys/kernel/debug/tracing/events/sched/sched_switch/enable
sleep 1
echo "event enabled"

echo 1 > /sys/kernel/debug/tracing/options/func_stack_trace
echo "function stack trace enabled"

echo 1 > /sys/kernel/debug/tracing/tracing_on
echo "tracing_on"


raspbian_fork: raspbian_test_fork.c
gcc -g -o raspbian_fork raspbian_test_fork.c


#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>

#define PROC_TIMES  50
#define SLEEP_DURATION  2
#define FORK_MAX_TIMES  3

void raspbian_proc_process(void);

void raspbian_proc_process(void) 
{
int proc_times = 0;
 
for(proc_times = 0; proc_times < PROC_TIMES; proc_times++) {
printf("raspbian tracing n");
sleep(SLEEP_DURATION);
}
}

int main() 
{
pid_t pid;
int fork_times = 0;

pid = fork();
if ( pid == 0 )  {
printf("start execution of child processn");
raspbian_proc_process();
}

else if ( pid > 0 ) {
printf("start execution of parent processn");
raspbian_proc_process();
}
}

덧글

댓글 입력 영역