From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24149 invoked by alias); 2 Jul 2008 19:15:04 -0000 Received: (qmail 24115 invoked by uid 22791); 2 Jul 2008 19:15:02 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 02 Jul 2008 19:14:43 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 420D5982C3; Wed, 2 Jul 2008 19:14:41 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id A97F298243; Wed, 2 Jul 2008 19:14:40 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1KE7mo-0000z9-80; Wed, 02 Jul 2008 15:14:38 -0400 Date: Wed, 02 Jul 2008 19:15:00 -0000 From: Daniel Jacobowitz To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: Re: [FYI] Inlining support, rough patch Message-ID: <20080702191438.GA3735@caradoc.them.org> Mail-Followup-To: Jan Kratochvil , gdb-patches@sourceware.org References: <20080613152754.GA4220@caradoc.them.org> <20080623115422.GA17511@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="2fHTh5uZTiUOsy+g" Content-Disposition: inline In-Reply-To: <20080623115422.GA17511@host0.dyn.jankratochvil.net> User-Agent: Mutt/1.5.17 (2008-05-11) 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: 2008-07/txt/msg00022.txt.bz2 --2fHTh5uZTiUOsy+g Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 834 On Mon, Jun 23, 2008 at 01:54:22PM +0200, Jan Kratochvil wrote: > Hi, > > here are some fixes on top of it. I find now your patch useful on top of CVS > HEAD. I expect some of its problems were probably due to the patch separation > from the CodeSourcery patchset. > > On x86+x86_64+ppc64 with gcc-4.3.1-2 (Fedora) there are no regressions. > On x86+x86_64 with gcc-4.3.1-2 (Fedora) the provided tests PASS. > (On ppc64 the tests FAIL as multi-PC breakpoints do not work there.) Thanks for the patches. Here's a copy of your diff minus the parts I've merged (or solved differently). I'm not planning to put in any of these parts yet, but we can talk about them if you have examples where they help. Let's wait on that until the rest of the patch is ready, though. I'm making good progress. -- Daniel Jacobowitz CodeSourcery --2fHTh5uZTiUOsy+g Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gdb-inline-works3.patch.left" Content-length: 6003 diff -up -u -X /home/jkratoch/.diffi.list -rupxCVS sources-codesourceryinline-gdb/breakpoint.c sources/gdb/breakpoint.c --- sources-codesourceryinline-gdb/breakpoint.c 2008-06-20 15:59:08.000000000 +0200 +++ sources/gdb/breakpoint.c 2008-06-22 23:45:57.000000000 +0200 @@ -3076,6 +3076,11 @@ bpstat_stop_status (CORE_ADDR bp_addr, p bs->print = 0; } bs->commands = copy_command_lines (bs->commands); + + /* We display the innermost inlined frame at a breakpont as it gives to + most of the available information. */ + if (b->type != bp_until && b->type != bp_finish) + set_skipped_inline_frames (0); } /* Print nothing for this entry if we dont stop or if we dont print. */ diff -up -u -X /home/jkratoch/.diffi.list -rupxCVS sources-codesourceryinline-gdb/frame.c sources/gdb/frame.c --- sources-codesourceryinline-gdb/frame.c 2008-06-20 15:59:09.000000000 +0200 +++ sources/gdb/frame.c 2008-06-22 18:01:02.000000000 +0200 @@ -422,12 +422,12 @@ frame_id_inner (struct gdbarch *gdbarch, if (!l.stack_addr_p || !r.stack_addr_p) /* Like NaN, any operation involving an invalid ID always fails. */ inner = 0; - else if (l.inline_depth > r.inline_depth + else if (l.inline_depth < r.inline_depth && l.stack_addr == r.stack_addr && l.code_addr_p == r.code_addr_p - && l.code_addr == r.code_addr + && (!l.code_addr_p || l.code_addr == r.code_addr) && l.special_addr_p == r.special_addr_p - && l.special_addr == r.special_addr) + && (!l.special_addr_p || l.special_addr == r.special_addr)) { /* Same function, different inlined functions. */ struct block *lb, *rb; @@ -1697,7 +1697,7 @@ find_frame_sal (struct frame_info *frame sym = inline_skipped_symbol (); init_sal (sal); - if (SYMBOL_LINE (sym) != 0) + if (sym && SYMBOL_LINE (sym) != 0) { sal->symtab = SYMBOL_SYMTAB (sym); sal->line = SYMBOL_LINE (sym); diff -up -u -X /home/jkratoch/.diffi.list -rupxCVS sources-codesourceryinline-gdb/infcmd.c sources/gdb/infcmd.c --- sources-codesourceryinline-gdb/infcmd.c 2008-06-20 15:59:09.000000000 +0200 +++ sources/gdb/infcmd.c 2008-06-17 20:57:03.000000000 +0200 @@ -758,7 +758,13 @@ step_1 (int skip_subroutines, int single if (!target_can_async_p ()) { for (; count > 0; count--) - step_once (skip_subroutines, single_inst, count, thread); + { + step_once (skip_subroutines, single_inst, count, thread); + + /* Unexpected breakpoint terminates our multistepping. */ + if (!stop_step) + break; + } do_cleanups (cleanups); } diff -up -u -X /home/jkratoch/.diffi.list -rupxCVS sources-codesourceryinline-gdb/inline-frame.c sources/gdb/inline-frame.c --- sources-codesourceryinline-gdb/inline-frame.c 2008-06-20 15:59:09.000000000 +0200 +++ sources/gdb/inline-frame.c 2008-06-23 00:54:53.000000000 +0200 @@ -90,7 +130,12 @@ inline_frame_sniffer (const struct frame frame_block = block_for_pc (this_pc); if (frame_block == NULL) return 0; + /* INLINE_SKIP_SYMBOL does not need to be set for each specific frame. But + * it needs to be recalculated after STEP_INTO_INLINE_FRAME according to new + * INLINE_SKIP_FRAMES - therefore SET_SKIPPED_INLINE_FRAMES is too early. */ + inline_skip_symbol = NULL; + /* Calculate DEPTH, the number of inlined functions at this location. */ depth = 0; @@ -104,7 +154,9 @@ inline_frame_sniffer (const struct frame { if (block_inlined_p (cur_block)) depth++; + if (depth == inline_skip_frames && inline_skip_symbol == NULL) + inline_skip_symbol = BLOCK_FUNCTION (cur_block); cur_block = BLOCK_SUPERBLOCK (cur_block); } @@ -189,7 +247,6 @@ set_skipped_inline_frames (int skip_ok) { CORE_ADDR this_pc; struct block *frame_block, *cur_block; - struct symbol *last_sym = NULL; int skip_count = 0; if (!skip_ok) @@ -219,19 +276,23 @@ set_skipped_inline_frames (int skip_ok) of BLOCK_START. */ if (BLOCK_START (cur_block) == this_pc || block_starting_point_at (this_pc, cur_block)) + skip_count++; + else { - skip_count++; - last_sym = BLOCK_FUNCTION (cur_block); + /* Here we will stop at any possible inlining after we + already crossed any first non-inlined function. We could + possibly detect such functions generating NORMAL_FRAME + by `!block_inlined_p && BLOCK_FUNCTION' (as + `!block_inlined_p && !BLOCK_FUNCTION' are just anonymous + local { ... } blocks). */ + break; } - else - break; } cur_block = BLOCK_SUPERBLOCK (cur_block); } } inline_skip_pc = this_pc; - inline_skip_symbol = last_sym; if (inline_skip_frames != skip_count) { diff -up -u -X /home/jkratoch/.diffi.list -rupxCVS sources-codesourceryinline-gdb/testsuite/gdb.cp/annota2.exp sources/gdb/testsuite/gdb.cp/annota2.exp --- sources-codesourceryinline-gdb/testsuite/gdb.cp/annota2.exp 2008-06-20 15:58:04.000000000 +0200 +++ sources/gdb/testsuite/gdb.cp/annota2.exp 2008-06-18 18:44:11.000000000 +0200 @@ -119,13 +119,14 @@ gdb_expect { # continue until exit # this will test: # annotate-exited +# `a.x is 1' is asynchronous regarding to `frames-invalid'. # send_gdb "continue\n" gdb_expect { - -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\na.x is 1\r\n\r\n\032\032exited 0\r\n\r\nProgram exited normally.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ + -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\r\n(\r\n\032\032frames-invalid\r\n)*a.x is 1\r\n(\r\n\032\032frames-invalid\r\n)*\r\n\032\032exited 0\r\n\r\nProgram exited normally.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ { pass "continue until exit" } - -re ".*$gdb_prompt$" { fail "continue to exit" } - timeout { fail "continue to exit (timeout)" } + -re ".*$gdb_prompt$" { fail "continue until exit" } + timeout { fail "continue until exit (timeout)" } } # --2fHTh5uZTiUOsy+g--