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 7836531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:11:57+00:00 2026-06-02T14:11:57+00:00

I wrote a small program to find how the exit() function works in Linux.

  • 0

I wrote a small program to find how the exit() function works in Linux.

#include <unistd.h>

int main()

{
    exit(0);
}

And then I compiled the program with gcc.

gcc -o  example -g -static example.c

In gdb, when I set a breakpoint, I got these lines.

Dump of assembler code for function exit:
0x080495a0 <+0>:    sub    $0x1c,%esp
0x080495a3 <+3>:    mov    0x20(%esp),%eax
0x080495a7 <+7>:    movl   $0x1,0x8(%esp)
0x080495af <+15>:   movl   $0x80d602c,0x4(%esp)
0x080495b7 <+23>:   mov    %eax,(%esp)
0x080495ba <+26>:   call   0x80494b0 <__run_exit_handlers>
End of assembler dump.

(gdb) b 0x080495a3
Function "0x080495a3" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (0x080495a3) pending.

(gdb) run
Starting program: /home/jack/Documents/overflow/example
[Inferior 1 (process 2299) exited normally]

The program does not stop at the breakpoint. Why? I use -static to compile the program, why does the breakpoint pend until the library loads into the memory?

  • 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-02T14:11:58+00:00Added an answer on June 2, 2026 at 2:11 pm

    You’re asking gdb to break on a function called 0x080495a3. You’ll need to use b *0x080495a3 instead.

    (gdb) help break
    Set breakpoint at specified line or function.
    break [LOCATION] [thread THREADNUM] [if CONDITION]
    LOCATION may be a line number, function name, or "*" and an address.
    

    As the help says, The * tells gdb it’s an address you want to break on.

    From your example:

    Function "0x080495a3" not defined.
    Make breakpoint pending on future shared library load? (y or [n]) y
    Breakpoint 1 (0x080495a3) pending.
    

    The “pending” means that the breakpoint is waiting until a function called 0x080495a3 is loaded from a shared library.


    You might also be interested in break-range:

    (gdb) help break-range
    Set a breakpoint for an address range.
    break-range START-LOCATION, END-LOCATION
    where START-LOCATION and END-LOCATION can be one of the following:
     LINENUM, for that line in the current file,
     FILE:LINENUM, for that line in that file,
     +OFFSET, for that number of lines after the current line
             or the start of the range
     FUNCTION, for the first line in that function,
     FILE:FUNCTION, to distinguish among like-named static functions.
     *ADDRESS, for the instruction at that address.
    
    The breakpoint will stop execution of the inferior whenever it executes
    an instruction at any address within the [START-LOCATION, END-LOCATION]
    range (including START-LOCATION and END-LOCATION).
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote this small C++ program and built it(Release) #include<iostream> int main(){ std::cout<<Hello World;
I wrote a small program to test GCC's options. int main() { int a=0;
I wrote this small program to find all occurrences of a substring in a
I wrote a small program, that creates files at an interval of 1 minute.
I wrote a small program to test accessing a widget parent's slot. Basically, it
So I wrote a project-management program for a small business using Microsoft Access 2007.
I wrote a small program that uses Mechanize to traverse a site. I want
Can I set a small program that I wrote as my login shell? Instead
I wrote a small program which frequently opens small, user text files and until
I'm developing a multithreaded program running on Linux (compiled with G++ 4.3) and if

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.