From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10722 invoked by alias); 9 Dec 2006 20:32:51 -0000 Received: (qmail 10636 invoked from network); 9 Dec 2006 20:32:32 -0000 Received: from unknown (195.23.133.213) by sourceware.org with QMTP; 9 Dec 2006 20:32:32 -0000 Received: (qmail 28544 invoked from network); 9 Dec 2006 20:32:32 -0000 Received: from unknown (HELO mailfrt09.isp.novis.pt) ([195.23.133.201]) (envelope-sender ) by mailrly03.isp.novis.pt with compressed SMTP; 9 Dec 2006 20:32:32 -0000 Received: (qmail 6581 invoked from network); 9 Dec 2006 20:32:31 -0000 Received: from unknown (HELO [127.0.0.1]) ([195.23.225.141]) (envelope-sender ) by mailfrt09.isp.novis.pt with SMTP; 9 Dec 2006 20:32:31 -0000 Message-ID: <457B1D40.7060302@portugalmail.pt> Date: Sat, 09 Dec 2006 20:32:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.8.0.8) Gecko/20061025 Thunderbird/1.5.0.8 Mnenhy/0.7.4.0 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [PATCH] i386_skip_prologue. References: <455EE79E.6000109@portugalmail.pt> <455EF845.40902@portugalmail.pt> <455F2754.5060703@portugalmail.pt> <20061118163738.GA14800@nevyn.them.org> In-Reply-To: <20061118163738.GA14800@nevyn.them.org> Content-Type: multipart/mixed; boundary="------------060706000304060703070501" X-Antivirus: avast! (VPS 0655-1, 08-12-2006), Outbound message X-Antivirus-Status: Clean X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-12/txt/msg00140.txt.bz2 This is a multi-part message in MIME format. --------------060706000304060703070501 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1929 Hi all, (moving this from gdb@, also at http://sources.redhat.com/ml/gdb/2006-11/msg00140.html) Daniel Jacobowitz escreveu: > On Sat, Nov 18, 2006 at 03:31:32PM +0000, Pedro Alves wrote: >> .loc 1 15 0 >> pushl %ebp >> LCFI0: >> movl $16, %eax >> movl %esp, %ebp >> LCFI1: >> subl $8, %esp >> LCFI2: >> .loc 1 15 0 >> andl $-16, %esp >> call __alloca >> call ___main >> .loc 1 17 0 > >> What do you think could be done to fix this? >> Is it the .loc directives that are being output wrong? Or is it gdb's >> prologue reader >> (if there is such a thing) that is missing the fact that __main is not >> user code? > > Probably both. The second line number marker normally marks the end of > the prologue, so GCC is wrong, and GDB might have to be taught about > _alloca and __main. > The i386 targets currently don't look at line number markers or the symbol table at all in i386_skip_prologue. I used the attached patch to test the gcc side of the fix, (http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00633.html) With the gcc patch above applied, this patch fixes all the runto_main issues on Cygwin. There are a few other FAILs related to breakpoints and main, but those are testsuite bugs, unrelated to this. I will send patches for those shortly. This are my current Cygwin/i386 results: === gdb Summary === # of expected passes 9897 # of unexpected failures 423 # of unexpected successes 1 # of expected failures 45 # of unknown successes 3 # of known failures 60 # of unresolved testcases 1 # of untested testcases 12 # of unsupported tests 26 (A lot of those seem to be signals related. I guess there are only a couple of bugs producing all of those failures.) Cheers, Pedro Alves --- 2006-12-09 Pedro Alves * i386-tdep.c (i386_skip_prologue): Try to find the end of the prologue using the symbol table. --------------060706000304060703070501 Content-Type: text/plain; name="symtabprol.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="symtabprol.diff" Content-length: 1226 Index: i386-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/i386-tdep.c,v retrieving revision 1.225 diff -u -p -r1.225 i386-tdep.c --- i386-tdep.c 8 Aug 2006 21:36:46 -0000 1.225 +++ i386-tdep.c 9 Dec 2006 19:30:25 -0000 @@ -825,6 +825,29 @@ i386_skip_prologue (CORE_ADDR start_pc) CORE_ADDR pc; gdb_byte op; int i; + char *func_name; + CORE_ADDR func_addr, func_end = 0; + + /* See what the symbol table says. */ + + if (find_pc_partial_function (start_pc, &func_name, &func_addr, &func_end)) + { + struct symbol *sym; + struct symtab_and_line sal; + + /* Found a function. */ + sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL, NULL); + if (sym && SYMBOL_LANGUAGE (sym) != language_asm) + { + /* Don't use this trick for assembly source files. */ + sal = find_pc_line (func_addr, 0); + if ((sal.line != 0) && (sal.end < func_end)) + return sal.end; + } + } + + /* Can't find the prologue end in the symbol table, try it the hard way + by disassembling the instructions. */ cache.locals = -1; pc = i386_analyze_prologue (start_pc, 0xffffffff, &cache); --------------060706000304060703070501--