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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:15:52+00:00 2026-06-13T15:15:52+00:00

I’m really new to assembly language, and I’m trying to decode an assembly file

  • 0

I’m really new to assembly language, and I’m trying to decode an assembly file generated from a binary (with gdb). I’m having trouble understanding the following code (this is the start of a new function). I am on an x64 machine and %rdi holds 6 digits (my input). So let’s just say that’s 0 1 2 3 4 5)

   400e79:       55                      push   %rbp
   400e7a:       48 89 e5                mov    %rsp,%rbp
   400e7d:       48 83 ec 30             sub    $0x30,%rsp
   400e81:       48 89 7d d8             mov    %rdi,-0x28(%rbp)
   400e85:       48 8d 75 e0             lea    -0x20(%rbp),%rsi
   400e89:       48 8b 7d d8             mov    -0x28(%rbp),%rdi

If I may, I want to show you what I THINK is going on:

400e79: So when we start a function, we push the old base pointer onto the stack. So the stack looks like:

 RETURN ADDRESS
 old %rbp value  <--- %rsp

400e7a: Stack looks like:

 RETURN ADDRESS
 old %rbp value <---- %rsp, %rbp

400e7d: Stack looks like:

 RETURN ADDRESS
 old %rbp value  <----%rbp
 ----empty----
 ----empty----
 ----empty----
 ----empty----
 ----empty----
 ----empty----  <---%rsp

400e81: The stuff from here is what’s really confusing me. We are moving what’s in %rdi (0 1 2 3 4 5) into -0x28(%rbp). So the stack looks like:

 RETURN ADDRESS
 old %rbp value  <----%rbp
 ----empty----
 ----empty----
 ----empty----
 ----empty----
 0 1 2 3 4 5
 ----empty----  <---%rsp

However, when I try to see what’s in -0x28(%rbp) by running x/s $rbp-0x28 on gdb, I don’t get 0 1 2 3 4 5 as I’d expect, but I get "\020C". Am I running this correctly?

400e85: Stack:

 RETURN ADDRESS
 old %rbp value  <----%rbp
 ----empty----
 ----empty----
 ----empty----
 ----empty---- <--- %rsi
 0 1 2 3 4 5
 ----empty----  <---%rsp

400e89: I don’t understand this at all. We just did mov %rdi,-0x28(%rbp) earlier, why are we now doing mov -0x28(%rbp),%rdi? Isn’t this repetitive?

Thanks a lot! I know this is really long, I appreciate your time helping me out!

  • 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-13T15:15:53+00:00Added an answer on June 13, 2026 at 3:15 pm

    Your analysis is correct.

    The reason you get a weird result when you run x/s $rbp-0x28 is that you can’t put a string in a register. The value the register contains is most likely a pointer to that string, which means you need another level of indirection to read it. I believe this will work:

    p/x *(char**)($rbp-0x28)
    x/s $
    

    As for the useless load, that is common for code which has been compiled without optimization. The compiler blindly converts each line to assembly without considering the current register values. I have seen code which passed a single value through several registers back to the register it was originally in.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want use html5's new tag to play a wav file (currently only supported
I am trying to render a haml file in a javascript response like so:
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has

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.