From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2506 invoked by alias); 29 Aug 2002 19:43:51 -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 2494 invoked from network); 29 Aug 2002 19:43:50 -0000 Received: from unknown (HELO localhost.redhat.com) (66.30.197.194) by sources.redhat.com with SMTP; 29 Aug 2002 19:43:50 -0000 Received: by localhost.redhat.com (Postfix, from userid 469) id 5664E108F6; Thu, 29 Aug 2002 15:41:55 -0400 (EDT) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15726.30979.37641.242222@localhost.redhat.com> Date: Thu, 29 Aug 2002 12:54:00 -0000 To: Keith Seitz Cc: Elena Zannoni , gdb-patches@sources.redhat.com Subject: Re: [RFA] stack.c: Always set current_source_{symtab,line} In-Reply-To: References: <15726.28975.902916.724508@localhost.redhat.com> X-SW-Source: 2002-08/txt/msg00991.txt.bz2 Keith Seitz writes: > On Thu, 29 Aug 2002, Elena Zannoni wrote: > > > Ok, I am going to be a PITA: does this odd behavior occur with non-mi > > gdb? I am not clear on why it is happening only with mi. Or at > > least I don't see it in regular gdb. > > This happens because we suppress printing the listing when we stop > (infrun.c/normal_stop): > Ahhh, right. Ok, I am convinced. Go ahead. Elena > if (stop_print_frame && selected_frame) > { > int bpstat_ret; > int source_flag; > int do_frame_printing = 1; > > bpstat_ret = bpstat_print (stop_bpstat); > switch (bpstat_ret) > { > case PRINT_UNKNOWN: > if (stop_step > && step_frame_address == FRAME_FP (get_current_frame ()) > && step_start_function == find_pc_function (stop_pc)) > source_flag = SRC_LINE; /* finished step, just print source line */ > else > source_flag = SRC_AND_LOC; /* print location and source line */ > break; > case PRINT_SRC_AND_LOC: > source_flag = SRC_AND_LOC; /* print location and source line */ > break; > case PRINT_SRC_ONLY: > source_flag = SRC_LINE; > break; > case PRINT_NOTHING: > source_flag = SRC_LINE; /* something bogus */ > do_frame_printing = 0; > break; > default: > internal_error (__FILE__, __LINE__, "Unknown value."); > } > /* For mi, have the same behavior every time we stop: > print everything but the source line. */ > if (ui_out_is_mi_like_p (uiout)) > source_flag = LOC_AND_ADDRESS; > > We use LOC_AND_ADDRESS to suppress source listings, but a side affect is > that it doesn't set current_source_symtab, either, because > current_source_symtab is set in print_source_lines_base, called from > print_source_lines, from print_frame_info_base: > > source_print = (source == SRC_LINE || source == SRC_AND_LOC); > > if (source_print && sal.symtab) > { > int done = 0; > int mid_statement = (source == SRC_LINE) && (fi->pc != sal.pc); > > if (annotation_level) > done = identify_source_line (sal.symtab, sal.line, mid_statement, > fi->pc); > if (!done) > { > if (print_frame_info_listing_hook) > { > print_frame_info_listing_hook (sal.symtab, sal.line, sal.line + 1, 0); > current_source_symtab = sal.symtab; > } > 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) > { > ui_out_field_core_addr (uiout, "addr", fi->pc); > ui_out_text (uiout, "\t"); > } > > print_source_lines (sal.symtab, sal.line, sal.line + 1, 0); > } > } > current_source_line = max (sal.line - lines_to_list / 2, 1); > } > > Keith >