繁体   English   中英

使用gdb进行调试时找不到调试符号

[英]No debugging symbol found in debugging with gdb

我正在使用gdb调试C4.5代码,但出现错误

GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./consult...(no debugging symbols found)...done.

C4.5的make文件在CFLAG中具有-g,并且附加了整个文件。 我遵循了一些讨论以进行类似的讨论。 但是还是有问题的。

Makefile
CFLAGS = -g -O2    
core.ln = \
    getnames.ln getdata.ln trees.ln getopt.ln header.ln    
trees.ln = \
    besttree.ln build.ln info.ln discr.ln contin.ln subset.ln\
    prune.ln stats.ln st-thresh.ln classify.ln confmat.ln\
    sort.ln $(core.ln)    
rules.ln = \
    rules.ln genlogs.ln genrules.ln makerules.ln prunerule.ln\
    siftrules.ln testrules.ln stats.ln confmat.ln sort.ln $(core.ln)    
core = \
    getnames.o getdata.o trees.o getopt.o header.o    
trees = \
    besttree.o build.o info.o discr.o contin.o subset.o prune.o\
    stats.o st-thresh.o classify.o confmat.o sort.o $(core)    
rules = \
    rules.o genlogs.o genrules.o makerules.o prunerule.o\
    siftrules.o testrules.o stats.o confmat.o sort.o $(core)    
c4.5:   c4.5.o $(trees)
cc -o c4.5 c4.5.o $(trees) -lm   
c4.5gt:
    cat defns.i types.i\
        c4.5.c\
        besttree.c build.c info.c discr.c contin.c subset.c\
        prune.c stats.c st-thresh.c confmat.c sort.c\
        getnames.c getdata.c classify.c trees.c header.c\
        | egrep -v 'defns.i|types.i|extern.i|buildex.i' >c4.5gt.c
    cc -O4 -o c4.5gt c4.5gt.c -lm
    rm c4.5gt.c  
c4.5rules: c4.5rules.o $(rules)
    cc -o c4.5rules c4.5rules.o $(rules) -lm  

c4.5rulesgt:
    cat defns.i types.i\
        c4.5rules.c\
        rules.c genlogs.c genrules.c makerules.c prunerule.c\
        siftrules.c testrules.c stats.c confmat.c sort.c\
        getnames.c getdata.c classify.c trees.c header.c\
        | egrep -v 'defns.i|types.i|extern.i|rulex.i' >c4.5rulesgt.c
    cc -O4 -o c4.5rulesgt c4.5rulesgt.c -lm
    rm c4.5rulesgt.c    
consult: consult.o userint.o $(core)
    cc -o consult consult.o userint.o $(core)    
consultr: consultr.o rules.o userint.o $(core)

    cc -o consultr consultr.o rules.o userint.o $(core)


.c.o:
    cc $(CFLAGS) -c $<


all:
    make c4.5
    make c4.5rules
    make consult
    make consultr
    cc -o xval-prep xval-prep.c
    cc -o average average.c -lm


$(trees): defns.i types.i extern.i
$(rules): defns.i types.i extern.i

当我检查文件咨询是否已剥离/未剥离时,它不会被剥离。 我还需要添加什么到make文件中,以便可以使用gdb调试Consult api? 谢谢

这有效

cc -ggdb3 -O0 -std=c11  -Wshadow ab.c -o ab


taras@taras: $ gdb ./ab

GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1
...

Reading symbols from ./ab...done.

Starting program: /home/taras/ab 7

(gdb) b 7

Breakpoint 1 at 0x40052e: file ab.c, line 7.

(gdb) r

Starting program: /home/taras/ab 7

Breakpoint 1, main () at ab.c:7

7               int n = 0, m = 0;

(gdb) n

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM