summaryrefslogtreecommitdiffstats
path: root/tester/covoar/AddressToLineMapper.cc
diff options
context:
space:
mode:
authorAlex White <alex.white@oarcorp.com>2021-07-16 13:01:08 -0500
committerJoel Sherrill <joel@rtems.org>2021-07-20 13:24:28 -0500
commit23808864e3bd4683d80cfcb6553c6cd4c3fbdcdd (patch)
treed1fdc4f6443dc3c4c10088f06a6101869a815344 /tester/covoar/AddressToLineMapper.cc
parentReportsText.h: Fix formatting (diff)
downloadrtems-tools-23808864e3bd4683d80cfcb6553c6cd4c3fbdcdd.tar.bz2
AddressToLineMapper.h: Remove pointer to temporary string
CID 1505281: Pointer to local outside scope Closes #4473
Diffstat (limited to 'tester/covoar/AddressToLineMapper.cc')
-rw-r--r--tester/covoar/AddressToLineMapper.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/tester/covoar/AddressToLineMapper.cc b/tester/covoar/AddressToLineMapper.cc
index c305e3b..838b156 100644
--- a/tester/covoar/AddressToLineMapper.cc
+++ b/tester/covoar/AddressToLineMapper.cc
@@ -19,9 +19,13 @@ namespace Coverage {
return is_end_sequence;
}
- const std::string& SourceLine::path() const
+ const std::string SourceLine::path() const
{
- return path_;
+ if (!path_) {
+ return "unknown";
+ } else {
+ return *path_;
+ }
}
int SourceLine::line() const
@@ -31,7 +35,8 @@ namespace Coverage {
void AddressLineRange::addSourceLine(const rld::dwarf::address& address)
{
- auto insertResult = sourcePaths.insert(address.path());
+ auto insertResult = sourcePaths.insert(
+ std::make_shared<std::string>(address.path()));
sourceLines.emplace_back(
SourceLine (