GSoC Project | Basic Support for Trace Compass

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Jun 27 11:04:20 UTC 2019


On 27/06/2019 12:51, Ravindra Kumar Meena wrote:
>      >
>      >     For whatever reason this file has only 98304 bytes. The
>     content looks
>      >     all right. So, the next step is to modify the client so that
>     it can
>      >     read
>      >     from a file instead of the TCP stream.
>      >
>      > I am trying to write code to read from the original raw record item.
> 
>     I am not sure why you want to do this. On which task are you currently
>     working?
> 
> I am working on the 2nd task to modify the record-client program to read 
> from a file if a --input=<FILE> command line option is given.

Could you please check in the part which adds the new option and the 
code which opens the file.

> 
> client_item record;
> while(fread(&record, sizeof(record), 1, input_file))
>          printf ("CPU=%d\n",record.cpu);
> 
> Here input_file is a file provided through the command.

The TCP stream you saved with nc from the target consists of struct 
rtems_record_item_32. In the code above you read struct client_item 
items. This cannot be right. When you don't know which content a file 
has, please ask.

You have to change this code here:

   while ( true ) {
     int buf[ 8192 ];
     ssize_t n;

     n = recv( fd, buf, sizeof( buf ), 0 );
     if ( n >= 0 ) {
       rtems_record_client_run( &ctx, buf, (size_t) n );
     } else {
       break;
     }
   }

First you should refactor the code and move the TCP relates stuff into 
separate functions.


-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list