From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22354 invoked by alias); 8 Mar 2008 16:55:56 -0000 Received: (qmail 22341 invoked by uid 22791); 8 Mar 2008 16:55:55 -0000 X-Spam-Check-By: sourceware.org Received: from nitzan.inter.net.il (HELO nitzan.inter.net.il) (213.8.233.22) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 08 Mar 2008 16:55:28 +0000 Received: from HOME-C4E4A596F7 (IGLD-83-130-196-141.inter.net.il [83.130.196.141]) by nitzan.inter.net.il (MOS 3.7.3a-GA) with ESMTP id JLI59473 (AUTH halo1); Sat, 8 Mar 2008 18:52:57 +0200 (IST) Date: Sun, 09 Mar 2008 19:01:00 -0000 Message-Id: From: Eli Zaretskii To: gdb@sources.redhat.com Subject: info proc cmd Reply-to: Eli Zaretskii X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-03/txt/msg00090.txt.bz2 There seems to be a bug in "info proc". The command line of the process is produced like this (in linux-nat.c): if (cmdline_f || all) { sprintf (fname1, "/proc/%lld/cmdline", pid); if ((procfile = fopen (fname1, "r")) != NULL) { fgets (buffer, sizeof (buffer), procfile); printf_filtered ("cmdline = '%s'\n", buffer); This seems to assume that the command line is stored in /proc/PID/cmdline as a single newline-terminated character string. But in fact the command-line arguments are stored there as a set of null-terminated strings. (Or at least that's what I see on two GNU/Linux systems I have access to from where I'm writing this, and the proc(5) man page says that as well.) So what we wind up doing is display only the first command-line argument. This bug is easy enough to fix, but I wonder whether some older versions of Linux did use the one-string format, in which case fixing this to assume a set of null-terminated arguments would break those old systems. Does anyone has further insight into the history of this? Should I just go ahead and fix the code?