From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 129509 invoked by alias); 8 Oct 2015 22:59:10 -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 129498 invoked by uid 89); 8 Oct 2015 22:59:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 X-HELO: p3plsmtpa09-06.prod.phx3.secureserver.net Received: from p3plsmtpa09-06.prod.phx3.secureserver.net (HELO p3plsmtpa09-06.prod.phx3.secureserver.net) (173.201.193.235) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 08 Oct 2015 22:59:09 +0000 Received: from [10.73.182.242] ([192.35.156.11]) by p3plsmtpa09-06.prod.phx3.secureserver.net with id Smz61r00S0F1m9401mz7cE; Thu, 08 Oct 2015 15:59:07 -0700 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.0 \(3094\)) Subject: Re: Bare metal "server" - cleaning up after a program From: Duane Ellis In-Reply-To: Date: Thu, 08 Oct 2015 22:59:00 -0000 Cc: gdb-mailing list Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Juha Aaltonen X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg00026.txt.bz2 >> Gdb seems so focused to debugging processes running within an OS, that >> "interpretation" in context of bare metal environment is hard. Bingo - you hit the problem nail on the head, bullseye! you also need to consider the situation when you want to =E2=80=9Chot-attac= h=E2=80=9D to a running process. perhaps your target is hung=E2=80=A6 and you want to attach to see *why is = this thing dead?=E2=80=9D or perhaps - where is this thing at? You might want to consider this to solve certain other problems: Use GDB-Python extensions Then - using Python, create your own new GDB commands. These commands - effectively send a GDB Remote packet to your gdb server GDB Python is enabled by default on Linux (Linaro GDB releases) And - latest release of (windows binary) Linaro GDB includes GDB Python [pr= eviously it was not enabled on windows] The ARM Embedded GDB (windows binary) already had this feature enabled. =09 What i mean is this:=20=20 Using Python, you can create any new GDB command Using python, you can execute any arbitrary GDB command, specifically the special maintenance command that lets you send an arbitra= ry packet You can also get the RESULT of that arbitrary [packet] command. You then your python module must take apart the ascii text the reply..=20 What would be better is this If GDB-Python exposed a =E2=80=9Cremote=E2=80=9D object that let you execu= te the REMOTE commands more generally It=E2=80=99s sort of a pain to =E2=80=9Cprintf()=E2=80=9D your command int= o an ascii command line. Stuff the ascii command line into GDB Capture the output ascii text Then covert this ascii text back into Binary data. (GDB need to expose more in the python area) Perhaps in the future, things will be better meanwhile - you do it they way I describe Why is this important? This lets you create any new command in GDB, that can do *anything* you ne= ed in your bare metal target. For example, you want to read/write CP14/CP15 register values? Your python script could clean up the MMU configuration or - perhaps Dump MMU mapping tables. In future you could extend this to create a command called: =E2=80=9Cmmu-d= ump=E2=80=9D or =E2=80=9Cmmu-explain ADDRESS=E2=80=9D=20 These would use MCR/MRC instructions to read the MMU config registers, then= access the MMU page tables and perhaps dump the mmu configuration, and/or translate a virtual address = to a physical address. In your case - launching a new application Once your GDB-Python script has done what it needs to do (i.e.: Reconfigure= , reset the target) you can use the normal =E2=80=9Cload=E2=80=9D commands = to load your image. -Duane.