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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:48:06+00:00 2026-06-11T23:48:06+00:00

In GDB, given a variable that points to a struct, print will display the

  • 0

In GDB, given a variable that points to a struct, print will display the raw pointer value and x will display the raw bytes pointed to. Is there any way to display the data pointed to as that struct, i.e. a list of fields and their values?

  • 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-11T23:48:07+00:00Added an answer on June 11, 2026 at 11:48 pm
    print *variable
    

    If you do that it will display the value of that variable in GDB.
    You also have an option to display the struct with indentation and new lines:

    $1 = {
      next = 0x0,
      flags = {
        sweet = 1,
        sour = 1
      },
      meat = 0x54 "Pork"
    }
    

    For that you need to set the pretty print:

    set print pretty on
    

    If you want to print an array of values you do:

    print *array@len
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In gdb, I can use the print command to display a floating point or
Is there a way to tell GDB to break right after a given function
I know that gdb allows for an already declared variable to be set using
Got a seg fault from my memcpy that gdb can't give me anything else
Every time I start gdb, I immediately do: set print thread-events off It would
I'm outside gdb's target executable and I don't even have a stack that corresponds
How do I set up gdb on window so that it does not allow
I have a pointer in GDB, how can I find out where it was
I love using GDB withing emacs. And I most like the configuration that I
I have the following data in a NSDictionary Variable: { value = TV-PG; }

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.