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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:37:46+00:00 2026-06-18T01:37:46+00:00

I was wondering how exactly .cfi_remember_state is implemented. I know it is a pseudo-op,

  • 0

I was wondering how exactly .cfi_remember_state is implemented. I know it is a pseudo-op, so I suppose it is converted into a couple of instructions when assembling. I am interested what exact instructions are used to implement it. I tried many ways to figure it out. Namely:

  • Read GAS source code. But failed to find anything useful enough.
  • Read GAS documentation. But the .cfi_remember_state entry is just a simple joke (literally).
  • Tried to find a gcc switch that would make gcc generate asm from C code with pseudo-ops “expanded”. Failed to find such a switch for x86 / x86-64. (Would be nice if someone could point me to such a switch, assuming it exists, BTW.)
  • Google-fu && searching on SO did not yield anything useful.

The only other solution in my mind would be to read the binary of an assembled executable file and try to deduce the instructions. Yet I would like to avoid such a daunting task.
Could any of You, who knows, enlighten me, how exactly it is implemented on x86 and/or x86-64? Maybe along with sharing how / where that information was acquired, so I could check other pseudo-ops, if I ever have the need to?

  • 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-18T01:37:47+00:00Added an answer on June 18, 2026 at 1:37 am

    This directive is a part of DWARF information (really all it does is emit DW_CFA_remember_state directive). Excerpt from DWARF3 standard:

    The DW_CFA_remember_state instruction takes no operands. The required
    action is to push the set of rules for every register onto an implicit
    stack.

    You may play with DWARF information using objdump. Lets begin with simple void assembler file:

      .text
    .globl main
      .type main, @function
    main:
    .LFB0:
    .cfi_startproc
    #.cfi_remember_state
    .cfi_endproc
    .LFE0:
      .size main, .-main
    

    Compile it with gcc cfirem.s -c -o cfirem.o

    Now disassemble generated DWARF section with objdump --dwarf cfirem.o
    You will get:

    00000018 00000014 0000001c FDE cie=00000000 pc=00000000..00000000
      DW_CFA_nop
      DW_CFA_nop
      ...
    

    If you will uncomment .cfi_remember_state, you will see instead:

    00000018 00000014 0000001c FDE cie=00000000 pc=00000000..00000000
      DW_CFA_remember_state
      DW_CFA_nop
      DW_CFA_nop
      ...
    

    So it is not really converting in assembler instructions (try objdump -d to see that there are no assembler instructions in our sample at all). It is converted in DWARF pseudo-instructions, that are used when debugger like GDB processes your variable locations, stack information and so on.

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

Sidebar

Related Questions

I'm just wondering how exactly does a delegate method know when to be called?
I'm just wondering exactly what factors affect how quickly createthread executes, and how long
I was reading litb's question about SFINAE here and I was wondering exactly what
I was wondering how exactly inner joins works in mysql. If I do SELECT
I'm wondering how exactly the XAML sample ( MSDN sample ) works: <Style x:Key=textBoxInError
I was wondering how exactly does TCP implement in-order delivery. lets say this is
I am wondering how exactly I can convert a location (X Y Z) to
Reading some posts from Jimmy Boggard and wondering - how exactly is it possible
I was wondering about how to exactly implement domain service in RIA. Is it
I am wondering , what exactly is stored in the memory when we say

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.