From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by sourceware.org (Postfix) with ESMTPS id 1918D3858D34 for ; Sun, 7 Jun 2020 22:28:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1918D3858D34 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=jguk.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=jg@jguk.org Received: by mail-wr1-x442.google.com with SMTP id p5so15378075wrw.9 for ; Sun, 07 Jun 2020 15:28:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jguk.org; s=google; h=from:subject:to:references:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=XSZxH/oAz1zewHh1f0Y4XKK7raJHwQsmFkoyBhfqBrY=; b=A6C48RYAa2QxRgRPuLEaRio1+nW3S1F0jLQqgY1pGEIjK0vnRHrrpTussDbXCjtaLM P2C/iePmD5JuK11bsYysPymU0j9s6EjIGkhTr4DcrKEDjXC8kt5O6VKKwz9Se5dToAC4 VMIrLesKLs56yMYIcUsSXwCSSwV6+e82vZHwvrOvsnjZCgL9EowFDds+aKnjVnGQnnBY X+99X/nn6eyHs3zy1QsH6lxvCLUJzidiepUB+/5GkGMW0vX7s/CnsRex9/WPYh6B0fij rfxvDylytywicV+fct3AwMFRluI+4x3tbUUzrMGyUo5eBd0s4BR1zynR5c3WB/uR+Szc /saA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=XSZxH/oAz1zewHh1f0Y4XKK7raJHwQsmFkoyBhfqBrY=; b=K18Q8JMgjiTGWN8kwdIH0Rb8IBTHmBg0JRKexVcF1dFYApUSwPxPtU31yhR3KZzI5s BlH6sFuQrWI4PlQptVIPYZ17FzrQwrq116LO9dB463AhsVW/CNuJA8A7dGOp1JhLgIpn PNvOoKzV/V2SBVMEtEvEtoUwSOoizJvQOzZFPwNKxJ39RwhKYmSgmKCdIfgw6RM3XZPj 4kgnQoqU5UCEtU5qx7Df1ZZQ3FVAG4QNYphJ1GgyZ50Y7iMvPHHFhnkRaJRNbRZ/nDIm +Kq7Ifku/89FVly0Wd3fDoBnLYTaDS0XbhX9UMoZjrx5bAGCn7G30lj3jBTao8SDzRKW vkiQ== X-Gm-Message-State: AOAM530dEXGPsHT7b4dX0UJgpOmF16iCUZsm5Fcy5XqCCOYnPv7cehiB 2Y2DpEcRdQFGHDFZZBfy4dw6FLnpFHc= X-Google-Smtp-Source: ABdhPJwPBJY7Y0JoZbqIcWQIsGy6QCbv+Uq2oBNsLtX0p7jO5jWxznhFcvKblKgn4S+7OCfT+VXVNg== X-Received: by 2002:a5d:45cb:: with SMTP id b11mr19680984wrs.235.1591568879802; Sun, 07 Jun 2020 15:27:59 -0700 (PDT) Received: from [192.168.0.12] (cpc87281-slou4-2-0-cust47.17-4.cable.virginm.net. [92.236.12.48]) by smtp.gmail.com with ESMTPSA id z2sm20889556wrs.87.2020.06.07.15.27.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Jun 2020 15:27:58 -0700 (PDT) From: Jonny Grant Subject: Re: gdb "Core was generated by" truncated to 80 characters To: Simon Marchi , gdb@sourceware.org References: <7ff0989f-e139-c25b-d407-a6209f507ed4@simark.ca> Message-ID: Date: Sun, 7 Jun 2020 23:27:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <7ff0989f-e139-c25b-d407-a6209f507ed4@simark.ca> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, TXREP, T_SPF_PERMERROR 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: Sun, 07 Jun 2020 22:28:02 -0000 On 26/05/2020 15:09, Simon Marchi wrote: > 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 It's a shame that is so small, the arguments are visible when running I thought in ps aux. Do you know who is the maintainer of that file please? I was going to proposed the comment is updated on this: char pr_fname[16]; /* filename of executable */ changing the comment to char pr_fname[16]; /* filename of executable with a NUL terminator */ My core has a truncated filename (pr_fname), so it ends up as ThreadPoolServi_S5.core for me here. > 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 > ... Great, thank you. I was checking on another core dump I have. ThreadPoolServi_S5.core Unfortunately for me I don't have these 'psargs' on my ThreadPoolServi_S5.core file. I imagine it is a thread, and created by pthread_setname_np although GDB manages to pull out as: Core was generated by `/usr/lib/chromium-browser/chromium-browser --enable-pinch --log-level=0 --enabl'. Program terminated with signal SIGTRAP, Trace/breakpoint trap. > 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. It would be nice if ARGV was prefixed in the memory with something unique, so I could find with strings. unfortunately the ELF file has no symbols Cheers, Jonny