Kconfig SourceCode GDB调试 *****

Posted qiuri2008

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Kconfig SourceCode GDB调试 *****相关的知识,希望对你有一定的参考价值。

1、GDB&makefile

  scripts->Makefile编译FLAGS  -g

HOSTCC      = gcc
HOSTCXX      = g++
HOSTCFLAGS    :=
HOSTCXXFLAGS    :=
include $(srctree)/scripts/Kbuild.include

HOSTCFLAGS    += $(call hostcc-option,-Wall -Wstrict-prototypes -O2 -g -fomit-frame-pointer,)
HOSTCXXFLAGS    += -O2

 静态模式:

  所有xxxconfig的目标都执行

    %config: scripts_basic outputmakefile FORCE customer
customer:
    ../code/tools/gen_radisson_customer.pl -C ../CUS_FILE
    

config: scripts_basic outputmakefile FORCE customer
#    $(Q)mkdir -p include
    $(Q)$(MAKE) $(build)=scripts/kconfig $@
    $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease

%config: scripts_basic outputmakefile FORCE customer
#    $(Q)mkdir -p include
    $(Q)$(MAKE) $(build)=scripts/kconfig $@
    $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease

 

Makefile的执行过程:

../code/tools/gen_radisson_customer.pl -C ../CUS_FILE

make -f scripts/Makefile.build obj=scripts/kconfig menuconfig
set -e;  echo \'  HOSTCC  scripts/kconfig/conf.o\'; 
gcc -Wp,-MD,scripts/kconfig/.conf.o.d -Wall -Wstrict-prototypes -O2 -g -fomit-frame-pointer \\
   -c -o scripts/kconfig/conf.o scripts/kconfig/conf.c; scripts/basic/fixdep scripts/kconfig/.conf.o.d scripts/kconfig/conf.o \\
  \'gcc -Wp,-MD,scripts/kconfig/.conf.o.d -Wall -Wstrict-prototypes -O2 -g -fomit-frame-pointer -c -o scripts/kconfig/conf.o scripts/kconfig/conf.c\' \\
  > scripts/kconfig/.conf.o.tmp; rm -f scripts/kconfig/.conf.o.d; mv -f scripts/kconfig/.conf.o.tmp scripts/kconfig/.conf.o.cmd
set -e; echo \' HOSTCC scripts/kconfig/kxgettext.o\';
gcc -Wp,-MD,scripts/kconfig/.kxgettext.o.d -Wall -Wstrict-prototypes -O2 -g -fomit-frame-pointer -c -o scripts/kconfig/kxgettext.o scripts/kconfig/kxgettext.c; scripts/basic/fixdep scripts/kconfig/.kxgettext.o.d scripts/kconfig/kxgettext.o
\'gcc -Wp,-MD,scripts/kconfig/.kxgettext.o.d -Wall -Wstrict-prototypes -O2 -g -fomit-frame-pointer -c -o scripts/kconfig/kxgettext.o scripts/kconfig/kxgettext.c\' > scripts/kconfig/.kxgettext.o.tmp;
rm -f scripts/kconfig/.kxgettext.o.d;
mv -f scripts/kconfig/.kxgettext.o.tmp scripts/kconfig/.kxgettext.o.cmd
set -e; echo \' HOSTCC scripts/kconfig/mconf.o\';
gcc -Wp,-MD,scripts/kconfig/.mconf.o.d -Wall -Wstrict-prototypes -O2 -g -fomit-frame-pointer -c -o scripts/kconfig/mconf.o scripts/kconfig/mconf.c; scripts/basic/fixdep scripts/kconfig/.mconf.o.d scripts/kconfig/mconf.o
\'gcc -Wp,-MD,scripts/kconfig/.mconf.o.d -Wall -Wstrict-prototypes -O2 -g -fomit-frame-pointer -c -o scripts/kconfig/mconf.o scripts/kconfig/mconf.c\' > scripts/kconfig/.mconf.o.tmp; rm -f scripts/kconfig/.mconf.o.d;
mv -f scripts/kconfig/.mconf.o.tmp scripts/kconfig/.mconf.o.cmd set -e; echo \' HOSTCC scripts/kconfig/zconf.tab.o\';
gcc -Wp,-MD,scripts/kconfig/.zconf.tab.o.d -Wall -Wstrict-prototypes -O2 -g -fomit-frame-pointer -Iscripts/kconfig -c -o scripts/kconfig/zconf.tab.o scripts/kconfig/zconf.tab.c; scripts/basic/fixdep scripts/kconfig/.zconf.tab.o.d scripts/kconfig/zconf.tab.o
\'gcc -Wp,-MD,scripts/kconfig/.zconf.tab.o.d -Wall -Wstrict-prototypes -O2 -g -fomit-frame-pointer -Iscripts/kconfig -c -o scripts/kconfig/zconf.tab.o scripts/kconfig/zconf.tab.c\' > scripts/kconfig/.zconf.tab.o.tmp;
rm -f scripts/kconfig/.zconf.tab.o.d;
mv -f scripts/kconfig/.zconf.tab.o.tmp scripts/kconfig/.zconf.tab.o.cmd set -e; echo \' HOSTLD scripts/kconfig/mconf\';
gcc -o scripts/kconfig/mconf scripts/kconfig/mconf.o scripts/kconfig/zconf.tab.o ; echo \'cmd_scripts/kconfig/mconf := gcc -o scripts/kconfig/mconf scripts/kconfig/mconf.o scripts/kconfig/zconf.tab.o \' > scripts/kconfig/.mconf.cmd
make
-f scripts/Makefile.build obj=scripts/kconfig/lxdialog

set -e; echo \' HOSTLD scripts/kconfig/lxdialog/lxdialog\';
gcc -o scripts/kconfig/lxdialog/lxdialog scripts/kconfig/lxdialog/checklist.o scripts/kconfig/lxdialog/menubox.o scripts/kconfig/lxdialog/textbox.o scripts/kconfig/lxdialog/yesno.o scripts/kconfig/lxdialog/inputbox.o scripts/kconfig/lxdialog/util.o scripts/kconfig/lxdialog/lxdialog.o scripts/kconfig/lxdialog/msgbox.o -lncursesw ; echo \'cmd_scripts/kconfig/lxdialog/lxdialog := gcc -o scripts/kconfig/lxdialog/lxdialog scripts/kconfig/lxdialog/checklist.o scripts/kconfig/lxdialog/menubox.o scripts/kconfig/lxdialog/textbox.o scripts/kconfig/lxdialog/yesno.o scripts/kconfig/lxdialog/inputbox.o scripts/kconfig/lxdialog/util.o scripts/kconfig/lxdialog/lxdialog.o scripts/kconfig/lxdialog/msgbox.o -lncursesw \' > scripts/kconfig/lxdialog/.lxdialog.cmd /bin/sh /home/kk/share/bak/512c/scripts_0925/scripts/kconfig/lxdialog/check-lxdialog.sh -check gcc -DCURSES_LOC="<ncurses.h>" -DLOCALE -lncursesw :
gdb scripts
/kconfig/mconf Config.in make -C /home/kk/share/bak/512c/scripts_0925 KBUILD_SRC= .kernelrelease

 

 

源代码

  整个UI的节点保存在“rootmenu”为“head”节点的链表中,即“rootmenu”为跟节点,“rootmenu”没有兄弟节点及父节点。

struct menu {
    struct menu *next;            //兄弟节点
    struct menu *parent;        //父节点
    struct menu *list;            //子节点链表,即下一级菜单的链表
    struct symbol *sym;            //节点符号
    struct property *prompt;    //节点提示符
    struct expr *dep;            //依赖
    unsigned int flags;
    //char *help;
    struct file *file;
    int lineno;
    void *data;
};

  如下图的UI:

   

 

 节点图:

  

(gdb) p rootmenu
$25 = {next = 0x0, parent = 0x0, list = 0x806bfe0, sym = 0x0, prompt = 0x8063d00, dep = 0x0, flags = 0, file = 0x0, lineno = 0, data = 0x0}
(gdb) p
*rootmenu.list $27 = {next = 0x8067e70, parent = 0x8062a80 <rootmenu>, list = 0x806c0f8, sym = 0x806bfa0, prompt = 0x806c058, dep = 0x0, flags = 1, file = 0x8067d98, lineno = 3, data = 0x0}
(gdb) p
*rootmenu.list->prompt $29 = {next = 0x0, sym = 0x806bfa0, type = P_PROMPT, text = 0x806c040 "BUILD_RECORD", visible = {expr = 0x0, tri = yes}, expr = 0x0, menu = 0x806bfe0, file = 0x8067d98, lineno = 4}
(gdb) p
*rootmenu.list->next->prompt $30 = {next = 0x0, sym = 0x8067e30, type = P_PROMPT, text = 0x8067ed0 "AQ", visible = {expr = 0x0, tri = yes}, expr = 0x0, menu = 0x8067e70, file = 0x8067df8, lineno = 4}
(gdb) p
*rootmenu.list->next->next->prompt $31 = {next = 0x0, sym = 0x0, type = P_MENU, text = 0x8067ff0 "System Application", visible = {expr = 0x0, tri = no}, expr = 0x0, menu = 0x8068018, file = 0x8067fa8, lineno = 1}
(gdb) p
*rootmenu.list->next->next->list->prompt $32 = {next = 0x0, sym = 0x8068078, type = P_PROMPT, text = 0x8068828 "System APP", visible = {expr = 0x0, tri = yes}, expr = 0x0, menu = 0x80687c8, file = 0x8067fa8, lineno = 4}
(gdb) p
*rootmenu.list->next->next->list->next $33 = {next = 0x8068dd0, parent = 0x8068018, list = 0x0, sym = 0x8068ce8, prompt = 0x0, dep = 0x8068d58, flags = 1, file = 0x8067fa8, lineno = 17, data = 0x0}
(gdb) p
*rootmenu.list->next->next->list->next->next->prompt $35 = {next = 0x0, sym = 0x0, type = P_MENU, text = 0x8068da8 "Product Location Select", visible = {expr = 0x0, tri = no}, expr = 0x0, menu = 0x8068dd0, file = 0x8067fa8, lineno = 22}

 

以上是关于Kconfig SourceCode GDB调试 *****的主要内容,如果未能解决你的问题,请参考以下文章

gdb调试程序函数名为问号,啥原因?

gd调试命令,gdb调试core文件

GDB调试

简述-gdb检测apk是不是可以被调试

在docker中使用gdb调试程序

如何用gdb调试erlang运行期