This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Semihosting output on ARM7TDMI


> On Tue, Aug 14, 2001 at 11:33:02AM -0400, Andrew Cagney wrote:
> 
>> > It looks like it needs to be changed so that it is
>> > pre-initialized so that stdin, stdout, and stderr are
>> > "pre-opened".  I think you'll need to change the code in
>> > rdi-share/hsys.c HostSysInit() so that fds 0,1,2, are
>> > initialized to map to FILE pointers stdin, stdout, stderr.
> 
>> 
>> Almost.  The theory is right.
>> 
>> For output the ``struct ui_file'' objects gdb_std*, normally target 
>> output is sent to gdb_stdtarg (one day I'll remember to rename it to 
>> gdb_targout).
> 
> 
> Er, wha?
> 
> The routines in rdi-remote/hsys.c have no idea that gdb is "up
> there" somewhere.
>
> The RDI file table is in a structure defined like so:
> 
> typedef struct {
>   FILE *FileTable[HSYS_FOPEN_MAX] ;
>   char FileFlags[HSYS_FOPEN_MAX] ;
>   char *TempNames[UNIQUETEMPS];
>   } OSblock;

If you don't route the output from the target through gdb_stdtarg then 
people, using GUI's, will complain that their output disappears or turns 
up in the wrong place.  gdb_stdtarg captures all output and then passes 
it through to things like the console.

How you manage to get the output routed to gdb_stdtarg, er, isn't my 
problem :-)

> It would be possible to make these routines "gdb aware" but
> they aren't at the moment -- semi-hosting requests are handled
> below the gdb<->RDI interface.

It isn't so much GDB aware not assume that the world is a UNIX tty.

>> For input, things get messy, if you look at remote.c and fixme's from me 
>> there are hopefully enough hints on how it can be done, in theory.  It 
>> is made complicated by the fact that there is an event look wanting a 
>> look-in.
> 
> 
> I think you're looking at the wrong target.  [;)] 

The theory is the same.  remote.c contains a working example of 
correctly wired output.  It also contains a nasty hack, from 
Cygnus/Cisco, to both co-ordinate target output and GDB input.

How much of that you need for tty UNIX I don't know.  I do know that and 
a lot more are needed to get GDB handling this correctly in a GUI 
environment.

	Andrew



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]