Re: Linux Kernel GDB tracepoint module 2010-8-30 release

Hui Zhu
2010-09-04T14:59:12Z

On Sat, Sep 4, 2010 at 17:26, Steven <mqyoung@gmail.com> wrote:
> On Sat, 2010-09-04 at 17:17 +0800, Hui Zhu wrote:
>> On Sat, Sep 4, 2010 at 16:56, Steven <mqyoung@gmail.com> wrote:
>> > On Sat, 2010-09-04 at 11:41 +0800, Hui Zhu wrote:
>> >> BTW, looks GCC and GDB don't want handle the optimization debug
>> >> trouble (all they want is rewrite the GCC in C++ :P).
>> >> So I think make linux kernel can close optimization is better idea, do
>> >> you know some way or some patch to do it?
>> >>
>> >
>> > Just disable CONFIG_CC_OPTIMIZE_FOR_SIZE and modify the Makefile of
>> > kernel:
>> > KBUILD_CFLAGS   += -O2
>> > to
>> > KBUILD_CFLAGS   += -O0
>>
>> Cool,  :)
>>
>> I try just change the compile option of readdir.c to without -O2, it
>> works OK.  I think maybe it's a GDB bug too.
>> Could you try the second issue with gdb 7.2?
>
> I have covered the two issues in the previous mail that I could collect
> both global variables and locals(-O0 kernel + gdb7.2):
>
>        --------
>        (gdb) trace vfs_readdir
>        Tracepoint 3 at 0xc11756a0: file fs/readdir.c, line 24.
>        (gdb) actions
>        Enter actions for tracepoint 3, one per line.
>        End with a line saying just "end".
>        >collect *file
>        >end
>        (gdb) trace fs/readdir.c:29
>        Tracepoint 4 at 0xc11756ca: file fs/readdir.c, line 29.
>        (gdb) actions
>        Enter actions for tracepoint 4, one per line.
>        End with a line saying just "end".
>        >collect res
>        >end
>        (gdb) tstart
>        (gdb) tstop
>        (gdb) tfind
>        Found trace frame 0, tracepoint 3
>        #0  0xc11756a1 in vfs_readdir (file=0xc7b2cf00, filler=0,
>        buf=0x0)
>            at fs/readdir.c:24
>        24              struct inode *inode =
>        file->f_path.dentry->d_inode;
>        (gdb) p *file
>        $4 = {f_u = {fu_list = {next = 0xc6dca500, prev = 0xc7ade480},
>        fu_rcuhead = {
>              next = 0xc6dca500, func = 0xc7ade480}}, f_path = {mnt =
>        0xc6c05300,
>            dentry = 0xc761d440}, f_op = 0xc1709a20, f_lock = {{rlock =
>        {raw_lock = {
>                  slock = 0}}}}, f_count = {counter = 2}, f_flags =
>        624640,
>          f_mode = 29, f_pos = 0, f_owner = {lock = {raw_lock = {lock =
>        16777216}},
>           = 0start = 0, size = 0, async_size = 0,
>            ra_pages = 32, mmap_miss = 0, prev_pos = -1}, f_version =
>        0,
>          f_security = 0xc7b30120, private_data = 0x0, f_ep_links = {
>            next = 0xc7b2cf74, prev = 0xc7b2cf74}, f_mapping =
>        0xc761c74c}
>        (gdb) p res
>        $5 = 0
>        (gdb) tfind
>        Found trace frame 1, tracepoint 4
>        0xc11756cb      29              res =
>        security_file_permission(file, MAY_READ);
>        (gdb) p res
>        $6 = -20
>        --------
>
>
>

Great. :)

Hui