Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8794367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:14:30+00:00 2026-06-13T23:14:30+00:00

I have a source file shared_lib_test.c in which there’s some code like below: 10

  • 0

I have a source file shared_lib_test.c in which there’s some code like below:

10 void test_function(void)
11 {
12    do_me();
13    skip_me();
14    return;
15 }

I want to use the gdb to skip the line 13, how should I do this? This function belongs to a shared library not a binary.

If this function belongs to a binary then I could use the following command to do it:

b shared_lib_test.c:13
commands 1
jump 14
continue
end

But as it belongs to shared library, I could not set a break point on the exact line number of the source file, I tried ‘b test_function +2’ but it seems illegal to gdb.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:14:31+00:00Added an answer on June 13, 2026 at 11:14 pm

    For Debugging shared libraries, you need to use

    set breakpoint pending — Set debugger’s behavior regarding pending breakpoints.

    It’s quite common to have a breakpoint inside a shared library. Shared libraries can be loaded and unloaded explicitly, and possibly repeatedly, as the program is executed. To support this use case, gdb updates breakpoint locations whenever any shared library is loaded or unloaded. Typically, you would set a breakpoint in a shared library at the beginning of your debugging session, when the library is not loaded, and when the symbols from the library are not available. When you try to set breakpoint, gdb will ask you if you want to set a so called pending breakpoint—breakpoint whose address is not yet resolved.

    gdb provides some additional commands for controlling what happens when the `break’ command cannot resolve breakpoint address specification to an address:

    set breakpoint pending auto
    This is the default behavior. When gdb cannot find the breakpoint location, it queries you whether a pending breakpoint should be created.

    set breakpoint pending on
    This indicates that an unrecognized breakpoint location should automatically result in a pending breakpoint being created.

    set breakpoint pending off
    This indicates that pending breakpoints are not to be created. Any unrecognized breakpoint location results in an error. This setting does not affect any pending breakpoints previously created.

    show breakpoint pending
    Show the current behavior setting for creating pending breakpoints.

    Coming to your question. i.e Skipping a line

    use jump +1 when your code reaches before that shared library line(skip_me()).

    References

    http://wiki.documentfoundation.org/Development/How_to_debug

    gdb: how to set breakpoints on future shared libraries with a –command flag

    http://bhushanverma.blogspot.in/2009/08/how-to-debug-shared-library-using-gdb.html

    http://www.toptip.ca/2010/06/gdb-skip-instructions-or-lines-while.html

    Can I use gdb to skip a line?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a c source file in which one of the method is defined
I have a C makefile which generates header file from java code and compiles
Given some source file test.cpp I would like to create a shared library libtest.so
I have a source file, openpage.pl, where I call use_module/1 to import SWI-Prolog's http_open/3:
I have a source file where 2 features have been added. In order to
Suppose I have a source file open and I launch a shell. I can
Suppose I have a source file that is 18218 bytes. I open the file
Referring here A is a precompiled Java class (I also have the source file)
I have a source XML file that is used to create C# files that
I have a large source file in Perforce that has been split up into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.