From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92646 invoked by alias); 15 Oct 2017 16:31:16 -0000 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 Received: (qmail 92560 invoked by uid 89); 15 Oct 2017 16:31:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=H*r:sk:gdb@sou, wheel, Hesham, hesham X-HELO: mail-io0-f179.google.com Received: from mail-io0-f179.google.com (HELO mail-io0-f179.google.com) (209.85.223.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 15 Oct 2017 16:31:09 +0000 Received: by mail-io0-f179.google.com with SMTP id i38so13631065iod.2 for ; Sun, 15 Oct 2017 09:31:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=YqC/cgWZRkEAHjAq8n42ExSJB7WymfBaOLLu0c4jmPk=; b=XtPsXbmTP9nuOToI514oZAnjb9a7h5wu+g1veezbXZP1xoE419CoH2N5AMosttKwu9 9f1shEmSO6JcPWxwhEa3e53XSEujOnb8SYxoROm/EsaRPdkje8EgW1JoC7jsU9a8mt1e FIqDo5BJitazmCoDvVVx5vu0fJTz5L7d+0QvwWmn9nog3JC2jC76K7WCl6IT+pdnUQNY qUvke0LoBmx0mOHBZqL4uKdzmk7zMwN5F+88HdEc0xY8+SnPopPOFEg3E52p82rgYSW+ qcAqZP7nx4jwyAzC5xTSpm8ootT8UlMeKZ4UVrS7ADox9+Ux+oA0CPnzu0MRh+GbNAXb 25vA== X-Gm-Message-State: AMCzsaX7AaXa2M/kCIVdMav1cUzfOTYSgWyOJBKhoQhNDuW1jbKgihB/ NEN0mZbjnurhpN7GUuseoMwNxcW1RJ3XhXhUvFQ= X-Google-Smtp-Source: ABhQp+Qtx1XwydC093G1Hm+bcR0TwITacV5SYrFKMvJ3HdJMRQ8/20KACy3MWOijL3Pm7WOvgOLWqNmUHQpb81m1K+M= X-Received: by 10.107.183.129 with SMTP id h123mr9794982iof.23.1508085067641; Sun, 15 Oct 2017 09:31:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.33.146 with HTTP; Sun, 15 Oct 2017 09:31:07 -0700 (PDT) In-Reply-To: References: <20171013201955.GK8425@1170ee0b50d5> From: Hesham M Date: Sun, 15 Oct 2017 16:31:00 -0000 Message-ID: Subject: Re: Postmortem debugging with arm-none-eabi-gdb from memory dump (not core) To: Christian Gagneraud Cc: gdb@sourceware.org Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2017-10/txt/msg00043.txt.bz2 On Sun, Oct 15, 2017 at 4:11 AM, Christian Gagneraud wrote: > On 14 October 2017 at 21:52, Hesham M wrote: >> On Fri, Oct 13, 2017 at 4:19 PM, Yao Qi wrote: >>> On 17-10-05 05:55:38, Hesham M wrote: >>>> Hi all, >>>> >>>> As this is my first email to the list, and as an old user for gdb, I'd like >>>> first to thank the gdb community for their effort. >>>> >>>> In a bare-metal ARM system, is there a way to use arm-none-eabi-gdb for >>>> postmortem debugging, the same way we do when we debug with core file on >>>> Linux, for example? >>>> >>>> The issue is that I don't have a "core" file but I can generate memory dump >>>> of the whole memory (ROM is already known and through the hardware debugger >>>> used I can write the RAM contents to a file (outside the target of course). >>>> I can also collect the registers at the time of the crash. I can do the >>>> debugging/analysis if I connect gdb to the target at the time of the crash >>>> but I need to do this in later time away from the target. I hope to find a >>>> way to debug with memory dumps the same way gdb debugs with core files. >>>> >>>> Of course if I can convert the memory dump to a valid core file, it might >>>> be another path to the solution. I don't know how to do that or if there is >>>> a tool that can help with this conversion. >>>> >>>> Any idea if this is possible? >>> >>> I prefer this approach, and it is possible. GDB has a command "gcore", >>> https://sourceware.org/gdb/current/onlinedocs/gdb/Core-File-Generation.html#index-generate_002dcore_002dfile >>> you can take a loop how GDB does it. > > Core dump are just ELF files, you might be able to create one yourself: > https://stackoverflow.com/questions/5986366/elf-core-file-format > > >>> >>>> >>>> A variant of this is idea is done for Keil tools: >>>> https://os.mbed.com/blog/entry/Post-mortem-debugging-with-ARM-mbed/ >>>> >>>> I have posted a similar question on stackoverflow but they closed it! So, >>>> please let me know if my question isn't clear. > > Do you have a link to this SO question? > > Chris Hi Chris, Thank for your reply. I know core is an elf file but it'd be helpful if there is a tool that can help or something in gdb that I can use instead of reinventing the wheel. If this is the only resort, I might need to do it. If this can be included somehow in GDB, provided nothing can do that now and there is interest in this, I can try to help. I'd need community support, though, as I haven't done any gdb work before. My deleted SO question link: https://stackoverflow.com/questions/46374391/postmortem-debugging-with-gdb-from-memory-dump-not-core Thanks, -Hesham