[PATCH rtems-tools v1] TraceConverter.cc: Add catch for exception

Chris Johns chrisj at rtems.org
Tue Oct 12 21:02:53 UTC 2021


The change is fine. The comment is about another possible change.

Thanks
Chris

On 13/10/21 5:22 am, Ryan Long wrote:
> CID 1471639: Add catch for exception
> 
> Closes #4501
> ---
>  tester/covoar/TraceConverter.cc | 45 ++++++++++++++++++++++++++---------------
>  1 file changed, 29 insertions(+), 16 deletions(-)
> 
> diff --git a/tester/covoar/TraceConverter.cc b/tester/covoar/TraceConverter.cc
> index 16c69d4..4a24bd4 100644
> --- a/tester/covoar/TraceConverter.cc
> +++ b/tester/covoar/TraceConverter.cc
> @@ -78,20 +78,21 @@ int main(
>    char** argv
>  )
>  {
> -  int                          opt;
> -  Trace::TraceReaderLogQEMU    log;
> -  Trace::TraceWriterQEMU       trace;
> -  const char                  *cpuname    = "";
> -  const char                  *executable = "";
> -  const char                  *tracefile  =  "";
> -  const char                  *logname = "/tmp/qemu.log";
> -  Coverage::ExecutableInfo*    executableInfo;
> -  rld::process::tempfile       objdumpFile( ".dmp" );
> -  rld::process::tempfile       err( ".err" );
> -  Coverage::DesiredSymbols     symbolsToAnalyze;
> -  bool                         verbose = false;
> -  std::string                  dynamicLibrary;
> -  int                          ec = 0;
> +  int                                 opt;
> +  Trace::TraceReaderLogQEMU           log;
> +  Trace::TraceWriterQEMU              trace;
> +  const char                         *cpuname    = "";
> +  const char                         *executable = "";
> +  const char                         *tracefile  =  "";
> +  const char                         *logname = "/tmp/qemu.log";

I know this is the same as above but does this work on Windows?

The toolkit has support for temporary files. Maybe a follow up patch to handle this?

> +  Coverage::ExecutableInfo*           executableInfo;
> +  rld::process::tempfile              objdumpFile( ".dmp" );
> +  rld::process::tempfile              err( ".err" );

Like here.

> +  Coverage::DesiredSymbols            symbolsToAnalyze;
> +  bool                                verbose = false;
> +  std::string                         dynamicLibrary;
> +  int                                 ec = 0;
> +  std::shared_ptr<Target::TargetBase> targetInfo;
>  
>    setup_signals();
>  
> @@ -128,9 +129,21 @@ int main(
>      usage();
>    }
>  
> +
>    // Create toolnames.
> -  std::shared_ptr<Target::TargetBase>
> -    targetInfo( Target::TargetFactory( cpuname ) );
> +  try
> +  {
> +    targetInfo.reset( Target::TargetFactory( cpuname ) );
> +  }
> +  catch ( rld::error re )
> +  {
> +    std::cerr << "error: "
> +              << re.where << ": " << re.what
> +              << std::endl;
> +    ec = 10;
> +
> +    return ec;
> +  }
>  
>    Coverage::ObjdumpProcessor objdumpProcessor( symbolsToAnalyze, targetInfo );
>  
> 


More information about the devel mailing list