public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* native gdb
@ 2022-04-18  6:07 Mahesh Bodapati
  2022-04-18 13:46 ` Simon Marchi
  0 siblings, 1 reply; 4+ messages in thread
From: Mahesh Bodapati @ 2022-04-18  6:07 UTC (permalink / raw)
  To: gdb

Hi All,
Target-linux-nat.c is the file for supporting native gdb?
for instance, I want to build a native gdb for MicroBlaze.

'--host=microblazeel-xilinx-linux-gnu'
'--target=microblazeel-xilinx-linux-gnu'


   1. what are steps for building native gdb which are specific to
   configure and flags.
   2. what files needs to be ported? and is there any guide for porting
   native gdb ?

Thanks,
Mahesh B

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: native gdb
  2022-04-18  6:07 native gdb Mahesh Bodapati
@ 2022-04-18 13:46 ` Simon Marchi
  2022-04-19  6:31   ` Mahesh Bodapati
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Marchi @ 2022-04-18 13:46 UTC (permalink / raw)
  To: Mahesh Bodapati, gdb



On 2022-04-18 02:07, Mahesh Bodapati via Gdb wrote:
> Hi All,
> Target-linux-nat.c is the file for supporting native gdb?
> for instance, I want to build a native gdb for MicroBlaze.
> 
> '--host=microblazeel-xilinx-linux-gnu'
> '--target=microblazeel-xilinx-linux-gnu'
> 
> 
>    1. what are steps for building native gdb which are specific to
>    configure and flags.

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.

At the simplest, it will be something like:

  .../configure --host=microblazeel-xilinx-linu-gnu --sysroot=<path to sysroot>
  make

But you will probably hit more problems that are typical of
cross-compilation (not specific to GDB), like making sure you have all
GDB dependencies built for Microblaze and installed in your sysroot.

>    2. what files needs to be ported? and is there any guide for porting
>    native gdb ?

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.

Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: native gdb
  2022-04-18 13:46 ` Simon Marchi
@ 2022-04-19  6:31   ` Mahesh Bodapati
  2022-04-19 20:15     ` Simon Marchi
  0 siblings, 1 reply; 4+ messages in thread
From: Mahesh Bodapati @ 2022-04-19  6:31 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb

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/"

Am I correct here? Please help me understand in detail.




On Mon, Apr 18, 2022 at 7:16 PM Simon Marchi <simon.marchi@polymtl.ca>
wrote:

>
>
> On 2022-04-18 02:07, Mahesh Bodapati via Gdb wrote:
> > Hi All,
> > Target-linux-nat.c is the file for supporting native gdb?
> > for instance, I want to build a native gdb for MicroBlaze.
> >
> > '--host=microblazeel-xilinx-linux-gnu'
> > '--target=microblazeel-xilinx-linux-gnu'
> >
> >
> >    1. what are steps for building native gdb which are specific to
> >    configure and flags.
>
> 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.
>
> At the simplest, it will be something like:
>
>   .../configure --host=microblazeel-xilinx-linu-gnu --sysroot=<path to
> sysroot>
>   make
>
> But you will probably hit more problems that are typical of
> cross-compilation (not specific to GDB), like making sure you have all
> GDB dependencies built for Microblaze and installed in your sysroot.
>
> >    2. what files needs to be ported? and is there any guide for porting
> >    native gdb ?
>
> 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.
>
> Simon
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: native gdb
  2022-04-19  6:31   ` Mahesh Bodapati
@ 2022-04-19 20:15     ` Simon Marchi
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Marchi @ 2022-04-19 20:15 UTC (permalink / raw)
  To: Mahesh Bodapati; +Cc: gdb

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-19 20:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-18  6:07 native gdb Mahesh Bodapati
2022-04-18 13:46 ` Simon Marchi
2022-04-19  6:31   ` Mahesh Bodapati
2022-04-19 20:15     ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).