From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 83A09386F432 for ; Tue, 26 May 2020 14:09:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 83A09386F432 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [172.16.0.95] (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id CAE241E792; Tue, 26 May 2020 10:09:39 -0400 (EDT) Subject: Re: gdb "Core was generated by" truncated to 80 characters To: Jonny Grant , gdb@sourceware.org References: From: Simon Marchi Message-ID: <7ff0989f-e139-c25b-d407-a6209f507ed4@simark.ca> Date: Tue, 26 May 2020 10:09:39 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: tl Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2020 14:09:42 -0000 On 2020-05-26 7:07 a.m., Jonny Grant wrote: > [Not sure if this got through to bug-gdb@gnu.orgĀ  so resending] gdb@sourceware.org is the right place. > Hello > > Just noticed my command line args of a core file are truncated, so it's hard to reproduce the crash as I don't know what the core was generated from. > > "Core was generated by" truncated to 80 characters in the below example. > > May I ask, is this a limitation of the kernel dump or gdb? When i use 'strings' I see the core does contain the full command line. You see the name of the process as dumped by the kernel, which truncates it at a certain length. Here's the corresponding code in the kernel, where you see it limited at 80 characters: https://elixir.bootlin.com/linux/v5.6.14/source/include/uapi/linux/elfcore.h#L79 You can inspect the note with eu-readelf: $ eu-readelf -a ./core ... CORE 136 PRPSINFO state: 0, sname: R, zomb: 0, nice: 0, flag: 0x0000000000400600 uid: 1000, gid: 1000, pid: 4049460, ppid: 3612973, pgrp: 4049460 sid: 3612973 fname: signal psargs: ./signal myverylonglonglongmyverylonglonglongmyverylonglonglongmyverylonglonglo ... The complete "command line" you see with strings comes from the fact that the argument array (argv) is present somewhere in memory. So if you are able to backtrace all the way to main, you might be able to print argc and argv and deduce the command line. Even if you aren't able to do that, you could still do a bit of forensic to find out where the argv array is located and get the information. Simon