Article View: comp.lang.asm.x86
Article #145Re: Debugging GNU assembler
From: Fabio Battinini
Date: Tue, 05 May 1998 00:00
Date: Tue, 05 May 1998 00:00
44 lines
2984 bytes
2984 bytes
On 1 May 1998, Eric Fowler wrote:
> I have some GNU assembler code running on FreeBSD. I am assembling using
> the gcc compiler/'as'-driver and would like to debug with gdb. To further
> establish my credentials as a masochist, I am doing this in text mode using
> vi.
> I can easily get gcc-compiled C code to generate symbols, but if I pass the
> -ggdb or the -g flag to gcc for assembler code, I get a binary that has no
> symbols(at least, that's what gdb says). How can I debug my assembler
> source in gdb?
Since what I could figure out, it's "cc1" (the first "stage" of
compiler) that inserts the debugging symbols (if you ask for 'em with
"-g"). Its output, is a file "name.s", that's assembly code.
After that, the assembler "as" take "name.s", giving an object file
"name.o" to the linker "ld", who links it with the needed libraries
(libc, libgcc, and any other ones eventually passed with "-l") and other
objects, and finally output the executable.
You can see this with "gcc -v ...", and you can eventually see
the single step file outputted, with the following:
-Let's state you have a "name.c" = C code
-"gcc -v -S name.c" -> "name.s" = assembly code
-"gcc -v -c name.s" -> "name.o" = object
-"gcc -v name.o -o name.exe" -> "name.exe" = executable (sorry for
.exe... :)
If you use "-g" in each step, you'll notice only first stage
changes ("name.s"), and if you look into it, you'll discover a lot of
added lines, that tell "gdb" what source file it comes from, which
procedure, and at what line...
All of this, to tell you how you can inspect what's happening
during that strange process of compilation (nothin' but translating from
one "higher" language to a "lower" one, since it's understandable by your
OS, and silicon chips... :), and last but -sadly- not least, to tell you
that you need an assembler debugger... :(
Here I can't be of any help...
PLEASE DOES ANYBODY KNOW WHERE WE CAN FIND AN ASSEMBLY DEBUGGER ?
(Possibly under Linux... :-)
I hope someone will help...
Sincerely, Fabio.
Technical Details
Message-ID:
<6indf0$5mn$1@winter.news.erols.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6icd56$b46$1@winter.news.erols.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,dcec7446a040194f X-Google-Attributes: gid11318c,public X-Google-Thread: 114917,dcec7446a040194f X-Google-Attributes: gid114917,public X-Google-Thread: 10ba33,dcec7446a040194f X-Google-Attributes: gid10ba33,public From: Fabio Battinini <battinin@cli.di.unipi.it> Subject: Re: Debugging GNU assembler Date: 1998/05/05 Message-ID: <6indf0$5mn$1@winter.news.erols.com> X-Deja-AN: 350467198 Approved: <johnfine@erols.com> References: <6icd56$b46$1@winter.news.erols.com> X-Mozilla-Status: 0801 Mime-Version: 1.0 X-Sender: battinin@lina Content-Type: TEXT/PLAIN; charset=US-ASCII X-Complaints-To: abuse@erols.com X-UIDL: 0f2f8e42f3 X-Trace: winter.news.erols.com 894384416 5847 207.172.240.23 (5 May 1998 16:06:56 GMT) Organization: Universita' di Pisa Newsgroups: comp.lang.asm.x86,gnu.gcc.help,gnu.g++.help