LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   source code (https://www.linuxquestions.org/questions/linux-software-2/source-code-435620/)

saif_shakeel 04-16-2006 05:34 AM

source code
 
hi,
this is my first post.i want to know as to how do i see the source code for programs compiled in gcc .there is a command but i am not getting it .could anyone help me out.
bye

y9701015 04-16-2006 05:41 AM

i think that you maybe find the "Building and Installing Software Packages for
Linux" article can answer your question.

saif_shakeel 04-16-2006 06:47 AM

reply
 
hi
sorry to confuse u guys. i meant how do i see the assembly code of the program written and not the "source code".
bye

Komakino 04-16-2006 07:42 AM

You'd need a disassembler. Once code has been compiled it's no longer 'human-readable' because it's in binary (or can be viewed as hex). A disassembler or decompiler would give you some idea of the source code, but it wouldn't be as the programmer wrote it, it would be a 'best guess' of the disassembler. If you want source code, most linux programs provide it.

saif_shakeel 04-16-2006 12:28 PM

url
 
hi,
where do i get the disassembler from,could u send me the link for the d/w.

Komakino 04-16-2006 01:04 PM

Search for dasm2. I'm not sure what you're hoping to gain from this...it's only going to give you a whole load of assembly language that'll be incredibly difficult to understand.

saif_shakeel 04-17-2006 12:41 PM

hi,

my aim is just to optimize the code when there are memory constraints,and by looking at assembly i hope to get an idea of writing efficent programs.
thx
bye

Komakino 04-17-2006 02:30 PM

Quote:

Originally Posted by saif_shakeel
hi,

my aim is just to optimize the code when there are memory constraints,and by looking at assembly i hope to get an idea of writing efficent programs.
thx
bye

Well you're not going to learn that from disassembled code. You're better of reading a book about optimising assembly language or joining some forums/newsgroups. Disassembled code isn't going to be optimised or efficient, even if it was originally written that way because when the code was compiled certain things may have happened to it (like loops being unrolled) that are not how the programmer originally wrote it. In short even a program written in assembly language will look different once it's been compiled and disassembled.

saif_shakeel 04-18-2006 12:59 AM

re
 
hi
thx for the info,i will keep that in mind.
bye


All times are GMT -5. The time now is 01:41 AM.