From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22678 invoked by alias); 11 Jan 2002 00:03:38 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 22621 invoked from network); 11 Jan 2002 00:03:35 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sources.redhat.com with SMTP; 11 Jan 2002 00:03:35 -0000 Received: from makita.cygnus.com (makita.sfbay.redhat.com [205.180.230.78]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id QAA11946 for ; Thu, 10 Jan 2002 16:03:34 -0800 (PST) Received: from localhost (keiths@localhost) by makita.cygnus.com (8.8.8+Sun/8.6.4) with ESMTP id QAA02829 for ; Thu, 10 Jan 2002 16:03:34 -0800 (PST) X-Authentication-Warning: makita.cygnus.com: keiths owned process doing -bs Date: Thu, 10 Jan 2002 16:03:00 -0000 From: Keith Seitz X-X-Sender: To: Subject: [RFA] stack.c: move address printing into hook (fwd) Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2002-01/txt/msg00262.txt.bz2 ---------- Forwarded message ---------- Date: Fri, 28 Dec 2001 07:47:18 -0800 (PST) From: Keith Seitz To: gdb-patches@sources.redhat.com Subject: [RFA] stack.c: move address printing into hook Hi, print_frame_info_base in stack.c is responsible for a great many things. It is used when doing backtraces, navigating the stack view, and when the inferior stops. When the inferior stops in mid-statement (after a stepi/nexti), print_frame_info_base is called to print out the current frame's PC and then it calls print_frame_info_listing_hook (or print_source_lines) to print out the contents of the source line. This is all fine and dandy for the command line, but for those user interfaces (like Insight) which define a print_frame_info_listing_hook to override this behavior, this address printing is an annoyance. It should be part of the if-else clause when the hook overrides the default behavior. The following patch folds this address printing into the hook, where it will not interfere with other UIs. This patch is obviously a no-op for the CLI, which does not define a print_frame_info_listing_hook. [Of course, the thought occurs to me that we could extract this bit of CLI-ness from "generic"/"core" gdb by moving all the logic into a this hook for the cli...] Keith ChangeLog 2001-12-28 Keith Seitz * stack.c (print_frame_info_base): Print the frame's pc only if when print_frame_info_listing_hook is not defined. Patch Index: stack.c =================================================================== RCS file: /cvs/src/src/gdb/stack.c,v retrieving revision 1.26 diff -u -p -r1.26 stack.c --- stack.c 2001/11/10 21:34:56 1.26 +++ stack.c 2001/12/28 15:43:05 @@ -399,20 +399,31 @@ print_frame_info_base (struct frame_info fi->pc); if (!done) { - if (addressprint && mid_statement) + if (print_frame_info_listing_hook) + print_frame_info_listing_hook (sal.symtab, sal.line, sal.line + 1, 0); + else { + /* We used to do this earlier, but that is clearly + wrong. This function is used by many different + parts of gdb, including normal_stop in infrun.c, + which uses this to print out the current PC + when we stepi/nexti into the middle of a source + line. Only the command line really wants this + behavior. Other UIs probably would like the + ability to decide for themselves if it is desired. */ + if (addressprint && mid_statement) + { #ifdef UI_OUT - ui_out_field_core_addr (uiout, "addr", fi->pc); - ui_out_text (uiout, "\t"); + ui_out_field_core_addr (uiout, "addr", fi->pc); + ui_out_text (uiout, "\t"); #else - print_address_numeric (fi->pc, 1, gdb_stdout); - printf_filtered ("\t"); + print_address_numeric (fi->pc, 1, gdb_stdout); + printf_filtered ("\t"); #endif + } + + print_source_lines (sal.symtab, sal.line, sal.line + 1, 0); } - if (print_frame_info_listing_hook) - print_frame_info_listing_hook (sal.symtab, sal.line, sal.line + 1, 0); - else - print_source_lines (sal.symtab, sal.line, sal.line + 1, 0); } current_source_line = max (sal.line - lines_to_list / 2, 1); }