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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:25:07+00:00 2026-05-31T09:25:07+00:00

When using gdb , I often get a nice list of parameters passed to

  • 0

When using gdb, I often get a nice list of parameters passed to functions. However, with certain functions like bind, I do not get the parameters:

(gdb) break bind
Breakpoint 1 at 0x404b40
(gdb) r
...
Breakpoint 1, bind () at ../sysdeps/unix/syscall-template.S:82
82      in ../sysdeps/unix/syscall-template.S
(gdb) bt
#0  bind () at ../sysdeps/unix/syscall-template.S:82
...

How can I still get the parameters passed to these functions?

  • 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-05-31T09:25:08+00:00Added an answer on May 31, 2026 at 9:25 am

    bind is one of socket system calls. There is a special way to put breakpoints on system calls in gdb – catch syscall <syscall name>. After this kind of breakpoint hit, you can watch syscall parameters in registers according to kernel calling conventions. For x86_64, parameters are passed via %rdi, %rsi, %rdx, %r10, %r8 and %r9 registers. For x86-32 – via %ebx, %ecx, %edx, %esi, %edi, %ebp registers.

    (gdb) catch syscall bind 
    Catchpoint 3 (syscall 'bind' [49])
    (gdb) r
    Starting program: /usr/bin/nmap google.com
    
    Starting Nmap 5.00 ( http://nmap.org ) at 2012-03-16 01:09 PDT
    Warning: Hostname google.com resolves to 6 IPs. Using 173.194.69.100.
    
    Catchpoint 3 (call to syscall 'bind'), 0x00007ffff6520307 in bind ()
       from /lib/libc.so.6
    (gdb) info registers 
    rax            0xffffffffffffffda   -38
    rbx            0xb35870 11753584
    rcx            0xffffffffffffffff   -1
    rdx            0x14 20
    rsi            0x7fffffff7d90   140737488321936
    rdi            0x8  8
    rbp            0x8  0x8
    rsp            0x7fffffff7d58   0x7fffffff7d58
    r8             0xb  11
    r9             0x8000   32768
    r10            0x7fffffff7b00   140737488321280
    r11            0x202    514
    r12            0xb09630 11572784
    r13            0xb359f0 11753968
    r14            0x2  2
    r15            0xc8 200
    rip            0x7ffff6520307   0x7ffff6520307 <bind+7>
    eflags         0x202    [ IF ]
    cs             0x33 51
    ss             0x2b 43
    ds             0x0  0
    es             0x0  0
    fs             0x0  0
    ---Type <return> to continue, or q <return> to quit---
    gs             0x0  0
    (gdb) 
    

    For example here %rdi contains first bind call parameter – socket file descriptor.

    For x86-32 things are more complicated as socket system calls are implemented via socketcall system call. Thats why it’s impossible to put catchpoint directly to bind. You can find more info about it here.

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

Sidebar

Related Questions

Is there a way to list all the loaded modules using gdb, just like
I know how to get the assembly code of my program using gdb but
Just curious. Using gcc/gdb under Ubuntu 9.10. Reading a C book that also often
I am using GDB to understand a C++ program. I put a break in
So I am debugging an x86 program using GDB. I am in a certain
I love using GDB withing emacs. And I most like the configuration that I
When using gdb and Vim, often I want to stop on a particular line.
Using gdb, I can type 'info threads' or 'thread apply all backtrace' to get
Using GDB, I find I get a segmentation fault when I attempt this operation:
How do I analyze the core dump (using gdb) which is not compiled with

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.