From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3333 invoked by alias); 23 Nov 2009 00:04:04 -0000 Received: (qmail 3172 invoked by uid 22791); 23 Nov 2009 00:04:04 -0000 X-SWARE-Spam-Status: No, hits=-0.4 required=5.0 tests=AWL,BAYES_50,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-pw0-f49.google.com (HELO mail-pw0-f49.google.com) (209.85.160.49) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 Nov 2009 00:02:59 +0000 Received: by pwj21 with SMTP id 21so3752834pwj.8 for ; Sun, 22 Nov 2009 16:02:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.202.17 with SMTP id z17mr472232wff.190.1258934577942; Sun, 22 Nov 2009 16:02:57 -0800 (PST) In-Reply-To: <20091122171617.GL18195@honey.hogyros.de> References: <3a665c760911220903y352e7062m2acfd5fb27a1b169@mail.gmail.com> <20091122171617.GL18195@honey.hogyros.de> Date: Mon, 23 Nov 2009 14:31:00 -0000 Message-ID: <3a665c760911221602y6ff771bdlbccdd27dc9fc0012@mail.gmail.com> Subject: Re: how to source level debug if I cannot see source embedded in elf file From: loody To: Simon Richter Cc: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-11/txt/msg00175.txt.bz2 Hi: thanks for your reply :) 2009/11/23 Simon Richter : > Hi, > > On Mon, Nov 23, 2009 at 01:03:36AM +0800, loody wrote: > >> If my tool chain cannot generate elf file without source embedded even >> I compile them with "-g", can I do the source level debugging? > > That assembler dump appears to be from a fully linked file, so I'd > suspect the debug info is stripped at link time. Have you passed the -g > option to the link step as well? first of all, I have to apologize that I have not described my environment more detail. I separate the compile process as first build the obj files, then link them together. Since my program separates at different directories and I need to build them each and finally link them together. I am not quite understand the "passed the -g option to the link step as well". I find the option described in ld document about "-g" below: -g Ignored. Provided for compatibility with other tools. Should I link them with "-g" as well? appreciate your help, miloody PS: below is my compile and link commands: /*my commands that I can see source */ mipsel-unknown-elf-gcc -g -G 0 -mips32r2 -fno-omit-frame-pointer -fno-optimize-sibling-calls -I./include -I./device/display -I./device/fatfs -I./device/misc -I./device/ntstrg -I./device/ntuart -I./device/ntxsub -I./device/vpu -I/media/sdb1/newlib-1.17.0/build/mipsel/include -D_ASSEMBLER_ -c init.S mipsel-unknown-elf-gcc -g -G 0 -mips32r2 -fno-omit-frame-pointer -fno-optimize-sibling-calls -I./include -I./device/display -I./device/fatfs -I./device/misc -I./device/ntstrg -I./device/ntuart -I./device/ntxsub -I./device/vpu -I/media/sdb1/newlib-1.17.0/build/mipsel/include -D_ASSEMBLER_ -c reset.S mipsel-unknown-elf-gcc -g -G 0 -mips32r2 -fno-omit-frame-pointer -fno-optimize-sibling-calls -I./include -I./device/display -I./device/fatfs -I./device/misc -I./device/ntstrg -I./device/ntuart -I./device/ntxsub -I./device/vpu -I/media/sdb1/newlib-1.17.0/build/mipsel/include -c atexit.c mipsel-unknown-elf-gcc -g -G 0 -mips32r2 -fno-omit-frame-pointer -fno-optimize-sibling-calls -I./include -I./device/display -I./device/fatfs -I./device/misc -I./device/ntstrg -I./device/ntuart -I./device/ntxsub -I./device/vpu -I/media/sdb1/newlib-1.17.0/build/mipsel/include -c main.c mipsel-unknown-elf-ld -T ./link.xn -o TestCode.elf -Map TestCode.map --oformat elf32-littlemips init.o reset.o atexit.o main.o -static -nostdlib -L/media/sdb1/newlib-1.17.0/build/mipsel/lib -L/root/bare_metal/x-tools/mipsel-unknown-elf/lib/gcc/mipsel-unknown-elf/4.2.4 -lc -lnullmon -lgcc rm -f TestCode.dla rm -f TestCode.dnm