<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="Am aO9 Al editable LW-avf tS-tW tS-tY" tabindex="1" style="min-height:85px" spellcheck="false">
On Wed, Jun 30, 2021 at 11:40 PM <chrisj@rtems.org> wrote:<br>
><br>
> From: Chris Johns <chrisj@rtems.org><br>
><br>
> - The member variable `path_` cannot be a reference and initialised to<br>
> a const char* type input. To do so would require there is a temporary with<br>
> an unspecified life time.<br>
> ---<br>
> tester/covoar/AddressToLineMapper.h | 2 +-<br>
> tester/covoar/Target_aarch64.h | 2 +-<br>
> 2 files changed, 2 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/tester/covoar/AddressToLineMapper.h b/tester/covoar/AddressToLineMapper.h<br>
> index 88bf475..c78aef7 100644<br>
> --- a/tester/covoar/AddressToLineMapper.h<br>
> +++ b/tester/covoar/AddressToLineMapper.h<br>
> @@ -84,7 +84,7 @@ namespace Coverage {<br>
> * An iterator pointing to the location in the set that contains the<br>
> * source file path of the address.<br>
> */<br>
> - const std::string& path_;<br>
> + const std::string path_;<br>
<br>
Ryan alerted me about this issue a couple weeks back. This patch would fix the problem, but it would lead to a second copy of every file path string being stored in memory. This would also take away the usefulness of the set of file path strings maintained
by the AddressLineRange class.<br>
<br>
Instead, I propose we change the empty SourceLine constructor to take a `const std::string&`. This would allow the addition of something like this to the top of AddressToLineMapper::getSource():<br>
const std::string unknown = "unknown";<br>
const SourceLine default_sourceline = SourceLine(unknown);
<div><br>
</div>
<div><span class="sew7pd9vqn73yos"></span><span class="sew7pd9vqn73yos"></span>That should eliminate the issue and preserve the memory conservation efforts of the original design.</div>
<div><br>
</div>
<div>Thanks,</div>
<div><br>
</div>
<div>Alex<br>
<br>
><br>
> /*!<br>
> * The source line number of the address.<br>
> diff --git a/tester/covoar/Target_aarch64.h b/tester/covoar/Target_aarch64.h<br>
> index 08bd1fb..1502df4 100644<br>
> --- a/tester/covoar/Target_aarch64.h<br>
> +++ b/tester/covoar/Target_aarch64.h<br>
> @@ -44,7 +44,7 @@ namespace Target {<br>
> bool isNopLine(<br>
> const char* const line,<br>
> int& size<br>
> - );<br>
> + ) override;<br>
><br>
> /*!<br>
> * This method determines if the specified line from an<br>
> --<br>
> 2.24.1<br>
><br>
> _______________________________________________<br>
> devel mailing list<br>
> devel@rtems.org<br>
> <a href="http://lists.rtems.org/mailman/listinfo/devel" id="LPlnk138568">http://lists.rtems.org/mailman/listinfo/devel</a></div>
</div>
</body>
</html>