Jump to content

How to look into memory?

- - - - -

  • Please log in to reply
3 replies to this topic

#1
jwxie518

jwxie518

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,180 posts
Professor gave us a challenge. He said the following (LOL fine.. paraphrased)

Quote

Suppose you have the following C++ statement:
c = a + b;
I don't care what u put for a and b.
a = 10, b = 200; I don't care.

I want you guys to be able to tell me the address of c, and in essence you can find the value before a+b and after a+b;
I don't want you to use cout. No printing on the screen. NO. This mean no reference, no pointer.

Now the problem is: I have never done any memory dump. I have linux by the way.
I was reading about hex dump (Hex dump - Wikipedia, the free encyclopedia)

Anyone can think of a good approach?

Thanks.

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
I am unsure of what he is looking for, however to point you in the right direction (yours at least) a hex editor would be hard to use.

For example, how could you find (so incredibly quickly) what value (among millions) relates to the integer c, and note what it contains before it is (nearly instantaneously) changed?

Try to guess at what software tool can track execution and track memory.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
You could use a debugger to get the current location of c in memory while it's running.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#4
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,721 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
"[...] no reference, no pointer." Sounds like a register thing to me.
sudo rm -rf /




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users