[linux-yocto] x86_64-poky-linux-gdb source level debugging

Bruce Ashfield bruce.ashfield at windriver.com
Wed May 8 07:55:34 PDT 2013


On 13-05-08 02:03 AM, Lai Eddy wrote:
>
> I can use x86_64-poky-linux-gdb to debug kernel module running on the
> x86_64 target,
> but the source code displayed in gdb (the right side code) is incorrect,
> (seems the left side "executing line#" is correct)
> I have set CFLAGS to -g -O0 in the Makefile, and have tried both
> pre-build toolchain and my build toolchain. same result.
> have also checked the gdb's source code file path is correct.

I'm definitely not a GDB/KGDB expert by anyone's definition. But I
did ask around a bit about this question.

The question is .. how have you loaded the symbols for the
kernel module. If the addresses aren't aligned, you won't get the
right source level debug.

i.e.

In gdb you want to run:
     info shared

And as a starting point you want compare that with the address from cat
/proc/modules.

Cheers,

Bruce




>
> (gdb) n
> 18776       {
> (gdb) n
> 18777       case PDS_WAIT_FOR_SERIAL:
> (gdb) n
> 18779           {
> (gdb) n
> 18780               p_l_buf[0] = ui1;
> (gdb) n
> 18781               memcpy(&(p_l_buf[1]), info_p->array_sn, 16);
> ----------------------------------------------
> real code is :
> 18776    c_special_state_flags &= ~CSSF_DISC_IN_PROG;
> 18777    for (ui1=0; ui1<2; ui1++)
> 18778    {
> 18779        info_p = _info_ps[ui1];
> 18780        ui2 = _disc_state[ui1];
> 18781        switch (ui2)
> 18782        {
> 18783        case PDS_WAIT_FOR_SERIAL:
> 18784            if (info_p->array_sn[0] != 0)
> 18785            {
> 18786                p_l_buf[0] = ui1;
> 18787                memcpy(&(p_l_buf[1]), info_p->array_sn, 16);
>
>
>
>
>
> _______________________________________________
> linux-yocto mailing list
> linux-yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/linux-yocto
>




More information about the linux-yocto mailing list