unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* assembly programming in Emacs how to
@ 2011-03-14  6:54 김태윤
  0 siblings, 0 replies; 5+ messages in thread
From: 김태윤 @ 2011-03-14  6:54 UTC (permalink / raw)
  To: help-gnu-emacs

assembly programming in Emacs how to?
I want Emacs to do following things
1. assembling
2. run the just before made program inside Emacs
3. debugging with watching flags and registers as like ollydbg or softice
4. decompile executable file for see what assembly codes are made by c
but I don't know how to do this.
could somebody let me know ?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: assembly programming in Emacs how to
       [not found] <mailman.6.1300112038.27831.help-gnu-emacs@gnu.org>
@ 2011-03-14 16:09 ` rusi
  2011-03-14 18:42 ` Pascal J. Bourguignon
  1 sibling, 0 replies; 5+ messages in thread
From: rusi @ 2011-03-14 16:09 UTC (permalink / raw)
  To: help-gnu-emacs

On Mar 14, 11:54 am, 김태윤 <kty1...@gmail.com> wrote:
> assembly programming in Emacs how to?
> I want Emacs to do following things
> 1. assembling
> 2. run the just before made program inside Emacs
> 3. debugging with watching flags and registers as like ollydbg or softice
> 4. decompile executable file for see what assembly codes are made by c
> but I don't know how to do this.
> could somebody let me know ?

emacs is (more or less) an editor.
For 1,2 you need an assembler
For 3,4 you need a disassembler/debugger

Assuming a linux, you can of course call an assembler like gas, a
disassembler like objdump, a debugger like gdb from inside emacs.
There are also more suitable debuggers for raw object code like edb
which you may prefer:
http://www.codef00.com/projects#debugger

But is that what you are asking??


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: assembly programming in Emacs how to
       [not found] <mailman.6.1300112038.27831.help-gnu-emacs@gnu.org>
  2011-03-14 16:09 ` assembly programming in Emacs how to rusi
@ 2011-03-14 18:42 ` Pascal J. Bourguignon
  2011-03-18  8:50   ` Ronnie Collinson
       [not found]   ` <mailman.2.1300438231.3305.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 5+ messages in thread
From: Pascal J. Bourguignon @ 2011-03-14 18:42 UTC (permalink / raw)
  To: help-gnu-emacs

김태윤 <kty1104@gmail.com> writes:

> assembly programming in Emacs how to?
> I want Emacs to do following things

  0. edit an assembler file.

Just open a file with the .s extension, or add a comment on the first
line with: -*- mode:asm -*-


> 1. assembling

M-x compile RET C-a C-k gcc -o pgm  pgm.s RET

> 2. run the just before made program inside Emacs

That would depend on the kind of user interface your program uses, and
whether  you want to run it with debugging or not.

Without debugging:

    - a daemon can be launched with:

         M-! pgm RET

    - a program with dumb terminal I/O (just read and write lines):

         M-x shell RET
         pgm RET

    - a program with sophisticated terminal I/O (ncurses):

         M-x term RET
         pgm RET

         M-x terminal-emulator RET
         pgm RET

         M-! xterm -e pgm & RET

     - a program with GUI:

         M-! pgm & RET

See also
http://groups.google.com/group/gnu.emacs.help/msg/458f28dae283b4da?hl=en



> 3. debugging with watching flags and registers as like ollydbg or
> softice

With debugging:

    - a daemon, or a program with dumb terminal I/O (just read and write
      lines), or a program with GUI can be launched with:

         M-x shell RET
         gdb pgm RET
         run RET


    - a program with sophisticated terminal I/O (ncurses):

         M-x term RET
         gdb pgm RET
         run RET

         M-x terminal-emulator RET
         gdb pgm RET
         run RET

         M-! xterm -e gdb pgm & RET
         run RET


There's also gud:

    M-x gud-gdb RET pgm RET

which offers better integration between the debugger and emacs, but I'm
not sure about the program I/O requirements.



> 4. decompile executable file for see what assembly codes are made by c
> but I don't know how to do this.

You may use commands such as objdump, or otool or disasm.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: assembly programming in Emacs how to
  2011-03-14 18:42 ` Pascal J. Bourguignon
@ 2011-03-18  8:50   ` Ronnie Collinson
       [not found]   ` <mailman.2.1300438231.3305.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Ronnie Collinson @ 2011-03-18  8:50 UTC (permalink / raw)
  To: Pascal J. Bourguignon; +Cc: help-gnu-emacs

Instead of decompiling to see the generated C code, you can tell GCC
to stop before assembling. gcc -S yourcfile.c, or use an option like
--save-temps to see all phases of compilation, and get the executable

On 3/15/11, Pascal J. Bourguignon <pjb@informatimago.com> wrote:
> 김태윤 <kty1104@gmail.com> writes:
>
>> assembly programming in Emacs how to?
>> I want Emacs to do following things
>
>   0. edit an assembler file.
>
> Just open a file with the .s extension, or add a comment on the first
> line with: -*- mode:asm -*-
>
>
>> 1. assembling
>
> M-x compile RET C-a C-k gcc -o pgm  pgm.s RET
>
>> 2. run the just before made program inside Emacs
>
> That would depend on the kind of user interface your program uses, and
> whether  you want to run it with debugging or not.
>
> Without debugging:
>
>     - a daemon can be launched with:
>
>          M-! pgm RET
>
>     - a program with dumb terminal I/O (just read and write lines):
>
>          M-x shell RET
>          pgm RET
>
>     - a program with sophisticated terminal I/O (ncurses):
>
>          M-x term RET
>          pgm RET
>
>          M-x terminal-emulator RET
>          pgm RET
>
>          M-! xterm -e pgm & RET
>
>      - a program with GUI:
>
>          M-! pgm & RET
>
> See also
> http://groups.google.com/group/gnu.emacs.help/msg/458f28dae283b4da?hl=en
>
>
>
>> 3. debugging with watching flags and registers as like ollydbg or
>> softice
>
> With debugging:
>
>     - a daemon, or a program with dumb terminal I/O (just read and write
>       lines), or a program with GUI can be launched with:
>
>          M-x shell RET
>          gdb pgm RET
>          run RET
>
>
>     - a program with sophisticated terminal I/O (ncurses):
>
>          M-x term RET
>          gdb pgm RET
>          run RET
>
>          M-x terminal-emulator RET
>          gdb pgm RET
>          run RET
>
>          M-! xterm -e gdb pgm & RET
>          run RET
>
>
> There's also gud:
>
>     M-x gud-gdb RET pgm RET
>
> which offers better integration between the debugger and emacs, but I'm
> not sure about the program I/O requirements.
>
>
>
>> 4. decompile executable file for see what assembly codes are made by c
>> but I don't know how to do this.
>
> You may use commands such as objdump, or otool or disasm.
>
>
> --
> __Pascal Bourguignon__                     http://www.informatimago.com/
> A bad day in () is better than a good day in {}.
>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: assembly programming in Emacs how to
       [not found]   ` <mailman.2.1300438231.3305.help-gnu-emacs@gnu.org>
@ 2011-03-18  9:46     ` Pascal J. Bourguignon
  0 siblings, 0 replies; 5+ messages in thread
From: Pascal J. Bourguignon @ 2011-03-18  9:46 UTC (permalink / raw)
  To: help-gnu-emacs

Ronnie Collinson <notthinking@gmail.com> writes:

> Instead of decompiling to see the generated C code, you can tell GCC
> to stop before assembling. gcc -S yourcfile.c, or use an option like
> --save-temps to see all phases of compilation, and get the executable

Good idea.  

So we could write an algorithm generating C sources, compiling them,
and comparing the produce binary with a target binary, until a match is
found.  Then we can compile with -S to get the assembler, or better just
read the 'decompiled' C code.

Quantum computers will be commercialised soon.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-03-18  9:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.6.1300112038.27831.help-gnu-emacs@gnu.org>
2011-03-14 16:09 ` assembly programming in Emacs how to rusi
2011-03-14 18:42 ` Pascal J. Bourguignon
2011-03-18  8:50   ` Ronnie Collinson
     [not found]   ` <mailman.2.1300438231.3305.help-gnu-emacs@gnu.org>
2011-03-18  9:46     ` Pascal J. Bourguignon
2011-03-14  6:54 김태윤

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).