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

  • Home
  • SEARCH
  • 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 7634969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:19:14+00:00 2026-05-31T07:19:14+00:00

I have very simple C program: int foobar(int a) { int b = a;

  • 0

I have very simple C program:

int foobar(int a)
{
    int b = a;
}

int main(int argc, char *argv[])
{
    foobar(0xDEAD);
    return 0;
}

Using objdump -d main.out I got disassembled binary with a lot of assembler instructions:

  4004a3:   55                      push   %ebp
  4004a4:   48 89 e5                mov    %esp,%ebp
  4004a7:   48 83 ec 10             sub    $0x10,%esp

How can I find for example address of every push instruction from another C program?
Can it be done this way?:

position = 0;
while (...)
{
   ...
   int act_value;
   read(binary_file, &act_value, 4);

   if (act_value == /*what value?*/)
   {
      printf("Instruction: push\n");
      printf("Address: %X\n", position * 4); /* is this correct?*/
   }
   position++;
   ...
}
  • 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-31T07:19:16+00:00Added an answer on May 31, 2026 at 7:19 am

    As Oli Charlesworth already pointed out, instructions are of variable length on the x86 architecture. You can still write a program to do this for you, but you’ll need to parse all the instructions to properly know how long they are and where the next one starts.

    I don’t understand why you want to write your own program to solve the problem, or is there something you’re not telling us? Are you only looking for a way to find the addresses of the push instructions? If so, just do this:

    objdump -d another_c_program | grep push
    

    Of course, this will also find pushl and so on. I guess you want them too, otherwise the command can be modified.

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

Sidebar

Related Questions

I have a very simple print program called print.c: #include <stdio.h> int main(void){ printf(Random
I have a very simple C++ application. #include <stdio.h> #include <iostream> int main(int argc,
I have created a very simple program that uses recursion. I'm using the g++
I have a very simple test program, running on Solaris 5.8: #include <stdio.h> #include
Have a look at this very simple example WPF program: <Window x:Class=WpfApplication1.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
I have a very simple WPF application in which I am using data binding
So I have a very simple program that reads the 3 first bytes of
I have a very simple program that I am trying to improve performance. One
I have a very simple program on OpenCV: #include <cv.h> #include <cxcore.h> #include <highgui.h>
I have a very simple program but this is giving me a seg fault.

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.