LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-07-2009, 03:50 AM   #1
Tordne
Member
 
Registered: Mar 2008
Location: London,UK
Distribution: Ubuntu
Posts: 37

Rep: Reputation: 15
disassembling and reading C code from executable


I'm quite new in programming, wrote a few programs.... But i want to get some ideas of the experts....

So I thought that linux was free and that we were able to read all the source codes.
But all the executables are binary files.
I tried lxr (that doesn't seem to work)
I tried ht that is unreadable for me...
I tried dissy just the same unreadble stuff....
I tried a program disassembler (where I first had to include a few headers in some files.... and still the output stays unreadable)

Please take me out of my misery and can someone tell me how I can open a binary executable (modified or not!) in emacs....

Thanks
 
Old 09-07-2009, 04:08 AM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
You just need to download the source files.
 
Old 09-07-2009, 06:46 AM   #3
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by graemef View Post
You just need to download the source files.
Looking at the first post, one would guess Tordne won't know how to do that.

1) You need to know the package name for the program whose sources you want to see.

2) You need to have the right deb-src repository in sources.list

3) Use the command
apt-get source package


I expect most Ubuntu users do package management in Synaptic, so doing things directly with apt may be new.

For item (1) you often can get that info by doing a search in Synaptic. If that doesn't tell you the package you want, there is an apt-file search command you could install and learn to use, but it is easier to use the online search at:
http://packages.ubuntu.com/
Scroll down to where it says Search the contents of packages

For item (2), you could use the settings/Repositories menu choice in Synaptic or you could more easily directly edit /etc/apt/sources.list (as root). You will see lines that begin with deb and for each of those you will want another line that is identical except that it begins with deb-src

Last edited by johnsfine; 09-07-2009 at 06:57 AM.
 
Old 09-07-2009, 07:44 AM   #4
Tordne
Member
 
Registered: Mar 2008
Location: London,UK
Distribution: Ubuntu
Posts: 37

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by johnsfine View Post
Looking at the first post, one would guess Tordne won't know how to do that.
thanks, and you're right. I didn't know...
I never needed them untill now...
But now I know...

Thanks...

PS: Now I can start writing some code in a certain standard.
My last program was quite messy after 1400 lines...
 
Old 09-07-2009, 08:33 AM   #5
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Quote:
Originally Posted by johnsfine View Post
Looking at the first post, one would guess Tordne won't know how to do that.
...nor did I in Ubuntu
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading an executable file adam405 Linux - Newbie 1 02-02-2009 04:23 AM
running executable in C++ code psIpher Programming 2 11-25-2005 01:44 PM
Reading Assembly code max_rsr Programming 4 07-22-2005 08:06 AM
how to convert C executable into Assembly Code indian Programming 4 10-04-2004 04:56 PM
Where can I find compilable/executable Ping source code johnsont Programming 3 09-12-2003 12:20 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration