From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 896653858D3C for ; Tue, 19 Apr 2022 20:15:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 896653858D3C Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 23JKF2I5031315 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Apr 2022 16:15:07 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 23JKF2I5031315 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (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 4D58F1EDF0; Tue, 19 Apr 2022 16:15:02 -0400 (EDT) Message-ID: <8b24f698-279a-731d-587c-c266861f20b7@polymtl.ca> Date: Tue, 19 Apr 2022 16:15:02 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: native gdb Content-Language: en-US To: Mahesh Bodapati Cc: gdb@sourceware.org References: From: Simon Marchi In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 19 Apr 2022 20:15:02 +0000 X-Spam-Status: No, score=-3034.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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, 19 Apr 2022 20:15:09 -0000 On 2022-04-19 02:31, Mahesh Bodapati wrote: > Thanks Simon, >>I'm not 100% sure I understand your question, but I assume you want to >>cross-compile GDB on an x86-64 build machine, so that GDB runs and >>debugs natively on a Microblaze Linux system. > > build != host == target (“cross-native”) > > native toolchain, as it targets the same machine as it runs on. But it is build on another machine. > > >>GDB already supports Microblaze, see files gdb/microblaze* in the tree. >>However, we didn't have contributions that touched those files for a >>while, so it's possible these have bitrotted a little bit. > > I didn't see any issues while I compile cross-compile gdb which runs on x86 and I assume 'microblaze-linux-nat.c' has to be ported/added as similar to other target to make it run on a target natively and also files to be ported for MicroBlaze at " gdb/nat/" Ah, you're right, the existing files are only -tdep files, so there's no native debugging support for Microblaze. So, yeah, you would need to add a microblaze-linux-nat.c, edit configure.nat to add an entry for Microblaze/Linux. microblaze-linux-nat.c would contain a class definition like class microblaze_linux_nat_target final : public linux_nat_target { ... } and a static instance like: static microblaze_linux_nat_target the_microblaze_linux_nat_target; Then, I would suggest looking at another "simple" architecture, like riscv-linux-nat.c, for inspiration. That architecture only defines some fetch_registers and store_registers methods, plus read_description. That's probably about the minimal things you need to get something working. Simon