- 主题:单独编译src下的单个程序
想编译一下ht代码/src/下的单个程序,方便用gdb跟踪来看懂此程序,但却总编译不成功,难道src下的程序,不能单独编译?
[bbs@xztu debug]$ gcc -g -o delete delete.c
delete.c:259: dereferencing pointer to incomplete type
delete.c:265: dereferencing pointer to incomplete type
delete.c:266: dereferencing pointer to incomplete type
delete.c: In function `kick_user':
delete.c:279: storage size of `uin' isn't known
delete.c:283: invalid use of undefined type `struct user_info'
delete.c:283: `LUSERS' undeclared (first use in this function)
delete.c:283: invalid use of undefined type `struct user_info'
delete.c:284: `OFFLINE' undeclared (first use in this function)
delete.c:284: invalid use of undefined type `struct user_info'
delete.c:284: `FRIEND' undeclared (first use in this function)
delete.c:285: `ADMIN' undeclared (first use in this function)
delete.c:304: `YEA' undeclared (first use in this function)
delete.c:312: `t_cmpuids' undeclared (first use in this function)
delete.c:314: dereferencing pointer to incomplete type
delete.c:322: invalid use of undefined type `struct user_info'
delete.c:322: invalid use of undefined type `struct user_info'
delete.c:323: invalid use of undefined type `struct user_info'
delete.c:331: `SIGHUP' undeclared (first use in this function)
delete.c:337: dereferencing pointer to incomplete type
delete.c:339: invalid use of undefined type `struct user_info'
delete.c:339: invalid use of undefined type `struct user_info'
delete.c:340: invalid use of undefined type `struct user_info'
--
FROM 220.172.239.*
又现起了一个办法,能不能直接跟踪/src/bbs这一个可执行文件,因为它是由src/下的所有程序生成的,但
(gdb) tb online
Note: breakpoint 1 also set at pc 0x80543aa.
Breakpoint 2 at 0x80543aa: file delete.c, line 173.
(gdb) s
The program is not being run.
(gdb) n
The program is not being run.
这样因为程序没有执行起来,所以不行。
(gdb) r
You cannot execute this program directly.
Program exited with code 0377.
这样又不能直接执行,那么只有在BBS界面运行的时候才能正常跟踪,就没有别的办法让这bbs这个程序,先执行起来?
【 在 sdymhua (胡搅蛮缠) 的大作中提到: 】
: 想编译一下ht代码/src/下的单个程序,方便用gdb跟踪来看懂此程序,但却总编译不成功,难道src下的程序,不能单独编译?
: [bbs@xztu debug]$ gcc -g -o delete delete.c
: delete.c:259: dereferencing pointer to incomplete type
: delete.c:265: dereferencing pointer to incomplete type
: ...................
--
FROM 220.172.239.*
因我要单个跟踪src下的某一个程序(比如delete.c),而gcc -g -o delete delete.c这样单独编译某一个程序,总是不成功。所以我现在想起了一个办法,能不能直接跟踪/src/ bbs这一个可执行文件,因为它是由src/下的所有程序生成。
但这个程序不能单独在shell直接执行,那么只有在BBS界面运行的时候才能正常跟踪,就没有别的办法让这个程序bbs先执行起来?
(gdb) r
You cannot execute this program directly.
Program exited with code 0377.
也就是说有没有像你说的那样设置环境变量的方法,让他在shell也可以像nju09/www文件设置好环境变量就能执行执行。感谢!!!
【 在 sdymhua (胡搅蛮缠) 的大作中提到: 】
: 又现起了一个办法,能不能直接跟踪/src/bbs这一个可执行文件,因为它是由src/下的所有程序生成的,但
: (gdb) tb online
: Note: breakpoint 1 also set at pc 0x80543aa.
: Breakpoint 2 at 0x80543aa: file delete.c, line 173.
: (gdb) s
: The program is not being run.
: ...................
--
FROM 220.172.239.*
单独编译得加很多参数的,至少也要有 -I ../include -I ../ythtlib -I ../libythtbbs
不过。。。我记得默认是带-g编译的,这要你看你自己的makefile了,我手里没代码了,学校的服务器又给停了~~~唉~
【 在 sdymhua.bbs@Zero.cn-bbs.org (胡搅蛮缠) 的大作中提到: 】
: 因我要单个跟踪src下的某一个程序(比如delete.c),而gcc -g -o delete delete.c这样单独编译某一个程序,总是不成功。所以我现在想起了一个办法,能不能直接跟踪/src/ bbs这一个可执行文件,因为它是由src/下的所有程序生成。
: 但这个程序不能单独在shell直接执行,那么只有在BBS界面运行的时候才能正常跟踪,就没有别的办法让这个程序bbs先执行起来?
: (gdb) r
: ...................
--
FROM 222.22.10.*
按照makefile里面的参数应该就可以单独编译了。。。
【 在 chutium@smth.org-SPAM.no (阿新) 的大作中提到: 】
: 单独编译得加很多参数的,至少也要有 -I ../include -I ../ythtlib -I ../libythtbbs
: 不过。。。我记得默认是带-g编译的,这要你看你自己的makefile了,我手里没代码了,学校的服务器又给停了~~~唉~
: 【 在 sdymhua.bbs@Zero.cn-bbs.org (胡搅蛮缠) 的大作中提到: 】
: : 因我要单个跟踪src下的某一个程序(比如delete.c),而gcc -g -o delete delete.c这样单独编译某一个程序,总是不成功。所以我现在想起了一个办法,能不能直接跟踪/src/ bbs这一个可执行文件,因为它是由src/下的所有程序生成。
: : 但这个程序不能单独在shell直接执行,那么只有在BBS界面运行的时候才能正常跟踪,就没有别的办法让这个程序bbs先执行起来?
: : (gdb) r
: : ...................
--
FROM 202.113.13.188