From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ronnie Collinson Newsgroups: gmane.emacs.help Subject: Re: assembly programming in Emacs how to Date: Fri, 18 Mar 2011 21:50:22 +1300 Message-ID: References: <87tyf5o86w.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1300438260 12179 80.91.229.12 (18 Mar 2011 08:51:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 18 Mar 2011 08:51:00 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "Pascal J. Bourguignon" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 18 09:50:56 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q0VOZ-0007Up-G1 for geh-help-gnu-emacs@m.gmane.org; Fri, 18 Mar 2011 09:50:56 +0100 Original-Received: from localhost ([127.0.0.1]:43927 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q0VOY-0000go-Ip for geh-help-gnu-emacs@m.gmane.org; Fri, 18 Mar 2011 04:50:54 -0400 Original-Received: from [140.186.70.92] (port=52217 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q0VOA-0000ek-EI for help-gnu-emacs@gnu.org; Fri, 18 Mar 2011 04:50:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q0VO4-0005kR-Ny for help-gnu-emacs@gnu.org; Fri, 18 Mar 2011 04:50:29 -0400 Original-Received: from mail-qy0-f169.google.com ([209.85.216.169]:59110) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q0VO4-0005k2-Lm for help-gnu-emacs@gnu.org; Fri, 18 Mar 2011 04:50:24 -0400 Original-Received: by qyk2 with SMTP id 2so626497qyk.0 for ; Fri, 18 Mar 2011 01:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=qBx/yoxKaM8wLb8aZT27IgovntOltMh+rDMTYDPQP8A=; b=eO8Ox/ptUWBnRuGRtIz2miWiwGrejwAA/IRgmBU+EKJKDA4kGymGaEvzfl0Y/Lm5MC i1sZ4pcbyW7WVIQG4FGtRFtR3KxZgvzzqMoW6eC7/oAjnWumfNux+YNzhq5HF4y0EYJP TLNRGhV5ZFFd37OO5i/2DrAC2VauspcYonNv4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=ZDWEIIH2beKQWMK+DuNW3eTDjy0+eCFU7D8UwRFa8jvFa0LPuodTrLrWH4dbysapKU HDgeJkn5n0kERmWH98o7ybG8GGXbB3xAIVIQQ3c35QW/ClYwpTrCd1EMnJqlt5buQ9yW fooAkpoe3RIsNJg1FsAUw1jD61TD4IMefXfu4= Original-Received: by 10.229.20.81 with SMTP id e17mr680221qcb.20.1300438222885; Fri, 18 Mar 2011 01:50:22 -0700 (PDT) Original-Received: by 10.229.98.1 with HTTP; Fri, 18 Mar 2011 01:50:22 -0700 (PDT) In-Reply-To: <87tyf5o86w.fsf@kuiper.lan.informatimago.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.216.169 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:80225 Archived-At: 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 wrote: > =EA=B9=80=ED=83=9C=EC=9C=A4 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=3De= n > > > >> 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 {}. >