Re: Regarding shared library and GDB - Linux

This is a discussion on Re: Regarding shared library and GDB - Linux ; On Sep 28, 12:16 pm, Andrei Voropaev wrote: > On 2007-09-27, sunil wrote: > > > > >> On Sep 27, 11:03 am, sunil wrote: > >> > Am interested to debug one shared library using GDB.This shared > >> ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Re: Regarding shared library and GDB

  1. Re: Regarding shared library and GDB

    On Sep 28, 12:16 pm, Andrei Voropaev wrote:
    > On 2007-09-27, sunil wrote:
    >
    >
    >
    > >> On Sep 27, 11:03 am, sunil wrote:
    > >> > Am interested to debug one shared library using GDB.This shared
    > >> > libarry is used by a binary (for which i doesn't have the code).I am

    > [...]
    > > yes I compiled the library properly.
    > > My problem is unable to caught the library using gdb while application
    > > executing the library.

    >
    > Strange. Why can't you catch it? Start gdb with the program. Before
    > issuing "run" set break point in your library function. gdb will tell
    > you that it does not exist and ask if you want that to be a "pending"
    > break point. Answer "yes". Now issue "run" comman. When the library is
    > loaded, gdb will try to find the specified function in it and set the
    > break point for you there.
    >
    > --
    > Minds, like parachutes, function best when open


    Hi,

    Thanks for your replies, Now am able to set the break point in my
    library and facing a different problem.
    I will explain my scenario one more time.

    Am trying to debug a shared library which is built by me.Thsi one is
    used by one application for which I doesn't have the code. I know when
    this library will be called after starting the application(by giving a
    call from the clien to that server my .so will be called) at the
    samtime am not fully aware about the input parameters for the
    application to start.(Generally this apllication will be called from
    shell scripts).Thats the reason I am vebugging the running process by
    taking the pid.

    After starting the gdb using PID of that running process ,I can find
    my library in the loaded shared library list.Even I can set the
    breakpoint for the functions of my shared library. After calling my
    shared library using the client the program,the gdb is able to stop
    the execution at the break point. But the problem is even after
    pressing the list or next command of gdb it is throwing the errors as
    below
    ======================================
    (gdb) b CCAAuthentication
    Breakpoint 1 at 0xfcfe55f8
    (gdb) b xauthn_initialize
    Breakpoint 2 at 0xfcfe32a0
    (gdb) c
    Continuing.
    [LWP 17 exited]
    [LWP 16 exited]
    [New LWP 517 ]
    [New Thread 517 (LWP 517)]
    [Switching to Thread 517 (LWP 517)]

    Breakpoint 2, 0xfcfe32a0 in xauthn_initialize () from /idam/CDAS/
    libcode/libxauthn.so
    (gdb) ls
    Undefined command: "ls". Try "help".
    (gdb) l
    1 ./libgcc2.c: No such file or directory.
    in ./libgcc2.c
    (gdb) n
    Single stepping until exit from function xauthn_initialize,
    which has no line number information.


    0xfcfe61d8 in __1cNpdxauthn_init6FpnKpam_handle_iippkc_L_ () from /
    idam/CDAS/libcode/libxauthn.so
    (gdb)
    Single stepping until exit from function
    __1cNpdxauthn_init6FpnKpam_handle_iippkc_L_,
    which has no line number information.
    0xfcfe6138 in __1cRcheck_initialized6FpnKpam_handle_iippkc_L_ () from /
    idam/CDAS/libcode/libxauthn.so
    (gdb)
    Single stepping until exit from function
    __1cRcheck_initialized6FpnKpam_handle_iippkc_L_,
    which has no line number information.
    0xfcfe624c in pam_sm_authenticate () from /idam/CDAS/libcode/
    libxauthn.so
    (gdb)
    ================================================== =

    Even i set the path to my code using the DIR command of gdb.
    If anybody knows about this error please let me know.

    Regards
    Sunil


  2. Re: Regarding shared library and GDB

    sunil writes:

    > Thanks for your replies, Now am able to set the break point in my
    > library and facing a different problem.


    If you have a different problem, you generally should post a new
    message, not a followup to your previous one.

    >> > yes I compiled the library properly.


    No, you didn't.

    > (gdb) b CCAAuthentication
    > Breakpoint 1 at 0xfcfe55f8
    > (gdb) b xauthn_initialize
    > Breakpoint 2 at 0xfcfe32a0


    The output above means that neither function was compiled with
    debug info (with '-g' flag). Without such info, source-level
    debugging will not be available.

    > If anybody knows about this error please let me know.


    We told you already: compile with '-g'.

    Cheers,
    --
    In order to understand recursion you must first understand recursion.
    Remove /-nsp/ for email.

  3. Re: Regarding shared library and GDB

    On 2007-11-02, sunil wrote:
    [...]
    > (gdb) c
    > Continuing.
    > [LWP 17 exited]
    > [LWP 16 exited]
    > [New LWP 517 ]
    > [New Thread 517 (LWP 517)]
    > [Switching to Thread 517 (LWP 517)]

    [...]

    Others pointed out already, that you don't have debugging info in your
    library. I just wanted to tell you that since you are debugging
    multithreaded application you should read the section on multithreading
    in gdb documentation. Basically, you should be aware that multiple
    threads can be stopped at your breakpoint and it will be confusing to
    follow all of them. GDB allows to set break point for single thread
    only. See documentation.

    --
    Minds, like parachutes, function best when open

  4. Re: Regarding shared library and GDB

    On Nov 4, 8:22 pm, Andrei Voropaev wrote:
    > On 2007-11-02, sunil wrote:
    > [...]> (gdb) c
    > > Continuing.
    > > [LWP 17 exited]
    > > [LWP 16 exited]
    > > [New LWP 517 ]
    > > [New Thread 517 (LWP 517)]
    > > [Switching to Thread 517 (LWP 517)]

    >
    > [...]
    >
    > Others pointed out already, that you don't have debugging info in your
    > library. I just wanted to tell you that since you are debugging
    > multithreaded application you should read the section on multithreading
    > in gdb documentation. Basically, you should be aware that multiple
    > threads can be stopped at your breakpoint and it will be confusing to
    > follow all of them. GDB allows to set break point for single thread
    > only. See documentation.
    >
    > --
    > Minds, like parachutes, function best when open


    Paul & Andrei

    thanks for u'r help. I enabled the debugging flag while linking rather
    than compiling stage.
    Thats the reason I wan unable to debug my code.Once again thanking you
    guys a lo for u'r kind help.

    Regards
    Sunil


+ Reply to Thread