From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13795 invoked by alias); 22 Mar 2018 09:04:36 -0000 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 Received: (qmail 125507 invoked by uid 89); 22 Mar 2018 09:04:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=Hx-languages-length:1746 X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Mar 2018 09:04:23 +0000 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2M8wrWJ011333 for ; Thu, 22 Mar 2018 05:04:21 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gv7ad5pxm-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 22 Mar 2018 05:04:21 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 22 Mar 2018 09:04:19 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 22 Mar 2018 09:04:16 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2M94G9c57540622; Thu, 22 Mar 2018 09:04:16 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4345FA4145; Thu, 22 Mar 2018 08:56:58 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2438BA4146; Thu, 22 Mar 2018 08:56:58 +0000 (GMT) Received: from oc1027705133.ibm.com (unknown [9.152.212.183]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 22 Mar 2018 08:56:58 +0000 (GMT) From: Andreas Arnez To: Simon Marchi Cc: Subject: Re: [PATCH] Make "info proc cmdline" show args on GNU/Linux References: Date: Thu, 22 Mar 2018 09:04:00 -0000 In-Reply-To: (Simon Marchi's message of "Wed, 21 Mar 2018 15:27:46 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 x-cbid: 18032209-0040-0000-0000-0000044415BD X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18032209-0041-0000-0000-000020E73D37 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-22_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803220108 X-IsSubscribed: yes X-SW-Source: 2018-03/txt/msg00412.txt.bz2 On Wed, Mar 21 2018, Simon Marchi wrote: > On 2018-03-21 09:15 AM, Andreas Arnez wrote: >> Currently "info proc cmdline" on GNU/Linux does not show the full command >> line, but only argument 0. And even a warning is shown if there are more. >> This was discussed in 2014 already: >> >> https://sourceware.org/ml/gdb-patches/2014-04/msg00212.html >> >> Follow the advice there and avoid target_fileio_read_stralloc. Instead, >> use target_fileio_read_alloc to read the whole command line and then >> replace NUL characters by spaces. Also add an appropriate test case. >> Note that gdbserver already handles this correctly. > > Hi Andreas, > > This LGTM with two minor nits: > [...] >> >> +# Set command line arguments to be verified later with "info proc >> +# cmdline". However, if we're using a stub, then "set args" would not >> +# have any effect, so then just skip this. >> + >> +set cmdline "" >> +if { ! [target_info exists use_gdb_stub] } { > > The use_gdb_stub proc from lib/gdb.exp should be used instead (its comment > explains why). Ah, OK. There are still some occurrences of "target_info exists use_gdb_stub" in the test suite. Should these be replaced as well? > >> + set cmdline "-i foo bar -o baz 1234" >> + gdb_test_no_output "set args $cmdline" "set args" >> +} >> + >> if { ! [ runto_main ] } then { >> untested "could not run to main" >> return -1 >> @@ -50,6 +60,9 @@ gdb_test "info proc mapping" \ >> "info proc mapping" >> >> if {[istarget "*-*-linux*"]} { >> + if { $cmdline != "" } { >> + gdb_test "info proc cmdline" "cmdline = \'.* $cmdline\'" > > The backslashes are unnecessary. Right. Thanks for your review. Pushed with these fixes. -- Andreas