ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!

Jump to content



Photo

how to convert c to assembly language???


  • Please log in to reply
how to convert c to assembly language???

#11

DirtyNorth
DirtyNorth
    Offline
    0
    Rep
    30
    Likes

    Junkie

Posts: 324
Threads: 10
Joined: Feb 10, 2019
Credits: 0

Five years registered
#11

put it in ida pro


  • 0

#12

FranckCastle
FranckCastle
    Offline
    0
    Rep
    12
    Likes

    Night is dark and full of terrors.

  • PipPipPip
Posts: 25
Threads: 0
Joined: May 04, 2019
Credits: 0
Four years registered
#12

NB: This method works using Code::Blocks IDE.

 

I presume you want your Code::Blocks build to generate an annotated assembly listing for each .c source file compiled.

 

Yes, you can do this as follows (as of Code::Blocks 12.11):

 

  • In the Code::Blocks IDE, navigate Settings -> Compiler
  • Ensure that the Selected compiler is GCC.

 

  • In the tab list that begins Compiler settings, Linker settings..., navigate to the last tab, Other settings.
  • In the Other settings pane, select Advanced options, at the bottom right.
  • In the Advanced compiler options windows, ensure that the drop-down menu entitled Command is set at Compile single file to object file
  • See the edit box entitled Command line macro and confirm that it contains the line:
  • $compiler $options $includes -c $file -o $object
  • To this line append a space followed by exactly this :

-Wa,-alhds=$objects_output_dir$file_name.list

 

  • (Do not allow yourself to be misled at this point by the listing of Command macros at the left of the window. If it lists $objectsoutputdir instead of $objects_output_dir and $filename instead of $file_name, it is wrong.)
  • Click OK in the Advanced compiler options window and then in the Compiler settings window.
  • Rebuild your project.

The effect of the change you have made to the global compiler settings is that the options:

 

-alhds=$objects_output_dir$file_name.list

will be passed to the assembly phase when compiling each source file filename.c, with $objects_output_dirreplaced by the object output files directory of your project and $file_name replaced by filename, causing the assembler to generate an annotated listing file filename.list in the same directory where filename.o is placed.

 

Unfortunately I do not see how to do this just for a selected project; so after the change the compiler will generate the .list files for all projects.

If this is a nuisance, you can work around it by first configuring a "new compiler" in Code::Blocks that is a copy of GCC, with whatever name you like, and then applying the change I have described to this copy. To do this:

  • Navigate Settings -> Compiler;
  • Ensure the Selected compiler is GCC
  • Select Copy and enter the name of your choice when prompted, e.g. "gcc-list"

 

Seen on : https://stackoverflow.com


Edited by FranckCastle, 04 May 2019 - 08:30 PM.

  • 0

#13

danielaaron1883
danielaaron1883
    Offline
    0
    Rep
    0
    Likes

    Member

Posts: 32
Threads: 0
Joined: Oct 08, 2017
Credits: 0
Six years registered
#13

You need to run it through an assembler

without turning it to executable  


  • 0

#14

IcyJake
IcyJake
    Offline
    0
    Rep
    -1
    Likes

    Member

Posts: 37
Threads: 17
Joined: Jan 28, 2018
Credits: 0

Six years registered
#14

Just run it through a compiler and make sure you enable assembly listing.


  • 0

april fools 2023!

~pumpernickel bitch


#15

Swaggetti
Swaggetti
    Offline
    0
    Rep
    0
    Likes

    New Member

  • PipPip
Posts: 20
Threads: 0
Joined: May 28, 2019
Credits: 0
Four years registered
#15

IDA pro? xDD


  • 0

#16

kekecoicou
kekecoicou
    Offline
    0
    Rep
    0
    Likes

    Advanced Member

  • PipPipPipPip
Posts: 134
Threads: 0
Joined: Dec 26, 2018
Credits: 0
Five years registered
#16

ty


  • 0

#17

Amitban40
Amitban40
    Offline
    0
    Rep
    2
    Likes

    Member

Posts: 53
Threads: 0
Joined: May 31, 2019
Credits: 0
Four years registered
#17

dk


  • 0

#18

MankeyDLaffy
MankeyDLaffy
    Offline
    0
    Rep
    0
    Likes

    New Member

Posts: 22
Threads: 0
Joined: Mar 08, 2019
Credits: 0
Five years registered
#18
Epic

  • 0

#19

Odnaim
Odnaim
    Offline
    0
    Rep
    0
    Likes

    Member

Posts: 55
Threads: 0
Joined: Jan 10, 2018
Credits: 0

Six years registered
#19

thx bro


  • 0

#20

selfadmirer
selfadmirer
    Offline
    2
    Rep
    3
    Likes

    Member

Posts: 66
Threads: 3
Joined: Feb 18, 2015
Credits: 0
Eight years registered
#20

I read this and spit coffee all over the place. I had to read the comments to make sure you wasn't joking!

To answer your question. Windows machine are in ASM at runtime since that's what the processor understands. You could accomplish your

goal with IDA, CheatEngine, VS, almost any memory editor/compiler/decompiler/assembler.   I use this all the time to accomplish assembly 

task without having to code in ASM. For instance, I was making a psuedoRNGenerator for a shot position on a game a while back. For the life of me I couldn't get it to generate a number in my extreme range and then convert it over to a usuable float. My solution: Code the PRNG'er in Cpp and then view the output in ASM86. A small tweak, return memory here and tada, I have my ASM PRNG'er. 


  • 0


 Users browsing this thread: