From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30891 invoked by alias); 29 Aug 2002 19:32:33 -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 30883 invoked from network); 29 Aug 2002 19:32:32 -0000 Received: from unknown (HELO valrhona.uglyboxes.com) (64.1.192.220) by sources.redhat.com with SMTP; 29 Aug 2002 19:32:32 -0000 Received: from localhost.localdomain (IDENT:EJaxttmicPYso0FiWY+OYuPopscST0q8@localhost.localdomain [127.0.0.1]) by valrhona.uglyboxes.com (8.11.6/8.11.6) with ESMTP id g7TJZBI06936; Thu, 29 Aug 2002 12:35:12 -0700 Date: Thu, 29 Aug 2002 12:43:00 -0000 From: Keith Seitz X-X-Sender: keiths@valrhona.uglyboxes.com To: Elena Zannoni cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] stack.c: Always set current_source_{symtab,line} In-Reply-To: <15726.28975.902916.724508@localhost.redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2002-08/txt/msg00990.txt.bz2 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): 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