본문 바로가기

유용한 디버깅 팁/crash utility and vmcore

(9)
[Linux kernel] vmcore enabled kernel configuration We need to turn on the following kernel configs: +CONFIG_CRASH_DUMP=y +CONFIG_KEXEC=y +CONFIG_KEXEC_FILE=y +CONFIG_DEBUG_INFO=y  08/23/2024
[crash-utility] How to pull and build crash-utility with ARM64 option 1. Please install utility to run crash-utility $ sudo apt-get install git build-essential bison zlib1g-dev libncurses5-dev libncursesw5-dev pkg-config flex swig -y 2. Pull crash-utility source code with below command. $ git clone https://github.com/crash-utility/crash.git 3. Build crash-utility Source code $ cd crash $ make target=ARM64 -j3 (Warninig) You may see error messages compiling crash-u..
[Install] crash utility with Aarch32 for troubleshooting When compiling crash utility in the Raspbian with Aarch32, do not use 'j' option like (make -j5). apt update apt-get install git build-essential bison zlib1g-dev libncurses5-dev libncursesw5-dev pkg-config flex swig -y apt-get install -y texinfo cd crash make target=ARM
[Debugging] crash-utility (11/10/2023) # good command to start 'crash utility' 1. 1st verified command ./crash dump1@0x80000000,dump2@0x880000000 -p 4096 -m vabits_actual=39 -m kimage_voffset=0xffffffbf70000000 --no_panic --smp $1 2. Under progress ./crash1 -d -6 SYS_COREDUMP -m --kaslr=0x1d43c00000 -m vabits_actual=39 -m kimage_voffset=0xffffffa611c00000 -m --smp vmlinux diff --git a/arm64.c b/arm64.c index bdb2a0a..7c3a8ea 100644 -..
[crash-utility] 컴파일 에러: curses.h: No such file or directory! 'crash-utility' 소스를 빌드하면 아래와 같은 에러를 만난다. gcc -c -g -DARM -D_FILE_OFFSET_BITS=64 -DGDB_10_2 -g -O2 build_data.c gcc -c -g -DARM -D_FILE_OFFSET_BITS=64 -DGDB_10_2 -g -O2 main.c main.c:20:10: fatal error: curses.h: No such file or directory #include ^~~~~~~~~~ compilation terminated. make[5]: *** [Makefile:336: main.o] Error 1 curses 라이브러리가 설치되지 않았을 때 이런 에러가 발생한다. 다음 커맨드를 사..
[리눅스커널][디버깅] Red Hat Crash-Utility(크래시 유틸리티) 설치! 리눅스 커널 동네에서 전 세계적으로 쓰고 있는 디버깅 툴을 소개하고자 합니다. https://people.redhat.com/anderson/ 레드헷의 앤더슨이란 형님이 만든 오픈 소스로 배포한 리눅스 크래시(커널 패닉)을 분석할 수 있는 툴인데요, 리눅스 커널 커뮤니티에서도 이 툴을 활발히 쓰고 있죠. 소스를 좀 받아 볼까요? 리눅스 머신에서 아래 커맨드로 소스를 땡겨옵니다. git clone https://github.com/crash-utility/crash.git 소스를 받고 나서 아래 명령어로 빌드를 해요. ARM machine인 경우 make target=ARM make target=ARM extensions X86인 경우 make target=X86_64 make target=X86_64 e..
[crash-utility] crash-utilty 실행 시 디버깅 옵션(-d 6) 디버깅 옵션(-d 6)을 적용해 crash-utilty를 실행하면 vmcore를 로딩하면서 다양한 디버깅 정보를 출력합니다. $ ./crash vmcore vmlinux -d 6 crash 7.3.0++ Copyright (C) 2002-2021 Red Hat, Inc. Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation Copyright (C) 1999-2006 Hewlett-Packard Co Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited Copyright (C) 2006, 2007 VA Linux Systems Japan K.K. Copyright (C) 2005, 2011, 2020-2021 NEC Corp..
[디버깅] Crash-Utility(디버깅 패치) 크래시 유틸리티를 디버깅할 수 있는 유용한 디버깅 패치다. 100% 내가 만든 것이다. diff --git a/arm64.c b/arm64.c --- a/arm64.c +++ b/arm64.c @@ -361,6 +361,19 @@ arm64_init(int when) /* use machdep parameters */ arm64_calc_phys_offset(); + error(INFO, "[+][%s][%d] at %s\n", __func__, __LINE__, __FILE__); + error(INFO, "kimage_voffset: %lx phys_offset: %lx \n", + machdep->machspec->kimage_voffset, machdep->machspec->phys_offset)..