From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28042 invoked by alias); 1 Jan 2010 10:36:00 -0000 Received: (qmail 28023 invoked by uid 22791); 1 Jan 2010 10:35:59 -0000 X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_00,FH_DATE_PAST_20XX X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Jan 2010 10:35:55 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id AE3232BABE7; Fri, 1 Jan 2010 05:35:53 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id jmcIlRJA9DWm; Fri, 1 Jan 2010 05:35:53 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 9AD8A2BAB51; Fri, 1 Jan 2010 05:35:52 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id EA8F3F5937; Fri, 1 Jan 2010 11:35:20 +0100 (CET) Date: Fri, 01 Jan 2010 10:36:00 -0000 From: Joel Brobecker To: Jan Kratochvil Cc: Nick Roberts , gdb@sourceware.org, gdb-patches@sourceware.org Subject: Re: [patch] Fix crash on CLI indented comments [Re: [Bug:cli] Loading user-defined function generates an internal error] Message-ID: <20100101103520.GR2788@adacore.com> References: <19258.59036.731093.439412@totara.tehura.co.nz> <20091230054617.GA548@adacore.com> <19259.54163.166299.854635@totara.tehura.co.nz> <20100101084028.GA29969@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="fOHHtNG4YXGJ0yqR" Content-Disposition: inline In-Reply-To: <20100101084028.GA29969@host0.dyn.jankratochvil.net> User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2010-01/txt/msg00012.txt.bz2 --fOHHtNG4YXGJ0yqR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 642 > 2010-01-01 Jan Kratochvil > > * cli/cli-script.c (process_next_line): Check P2 overrun. Yes - I agree it's obvious when you know that the comment is stripped upstream... Approved. Thanks for fixing. Given the number of regressions/failures we've seen in this area, I really thought we should add a test for this, so I created the attached patch. I will commit after you have committed yours. gdb/testsuite/ Test indented comment in file being sourced. * commands.exp: Test indented comment in file being sourced. Tested on x86_64-linux. Fails miserably without Jan's patch. -- Joel --fOHHtNG4YXGJ0yqR Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="test-indented-comment.diff" Content-length: 1246 commit 0f79c42a551762d87088fd5916c4ed390dde9942 Author: Joel Brobecker Date: Fri Jan 1 14:31:07 2010 +0400 Test indented comment in file being sourced. * commands.exp: Test indented comment in file being sourced. diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp index 2aba51f..228c464 100644 --- a/gdb/testsuite/gdb.base/commands.exp +++ b/gdb/testsuite/gdb.base/commands.exp @@ -577,6 +577,19 @@ proc stray_arg0_test { } { "stray_arg0_test #4" } +# Test that GDB is able to source a file with an indented comment. +proc source_file_with_indented_comment {} { + set fd [open "file1" w] + puts $fd \ +{define my_fun + #indented comment +end +echo Done!\n} + close $fd + + gdb_test "source file1" "Done!" "source file with indented comment" +} + # Test that GDB can handle arguments when sourcing files recursively. # If the arguments are overwritten with ####### then the test has failed. proc recursive_source_test {} { @@ -761,6 +774,7 @@ deprecated_command_test bp_deleted_in_command_test temporary_breakpoint_commands stray_arg0_test +source_file_with_indented_comment recursive_source_test if_commands_test redefine_hook_test --fOHHtNG4YXGJ0yqR--