Re: native gdb

Simon Marchi via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.