libdebugger: Fix #12944.

LocatableFile:
- If there is no parent path, don't insert a path separator between parent
  and filename. This may be the case depending on how the source file was
  specified during compilation.

FileManager:
- When constructing an EntryPath from a LocatableEntry, ensure that the
  parent folder actually has a path string that isn't simply empty to ensure
  consistency with the raw dir/file case. Otherwise, hash lookups that are
  dependent on the parent dir being NULL if not specified will fail, causing
  us to not locate the file successfully. This was preventing us from updating
  source location information for make 4.2's main.c, as the latter was
  specified in such a way that the above combination of conditions would
  occur, and consequently when asking the FileManager to update the source
  location with the actual file, the entry couldn't be found in the table,
  and no information would be updated.
This commit is contained in:
Rene Gollent 2016-09-06 22:50:55 -04:00
parent ed99a95f35
commit 584fd9619c
2 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,6 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2011-2013, Rene Gollent, rene@gollent.com.
* Copyright 2011-2016, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
@ -41,9 +41,12 @@ struct FileManager::EntryPath {
EntryPath(const LocatableEntry* entry)
:
directory(entry->Parent() != NULL ? entry->Parent()->Path() : NULL),
directory(NULL),
name(entry->Name())
{
LocatableDirectory* parent = entry->Parent();
if (parent != NULL && strlen(parent->Path()) > 0)
directory = parent->Path();
}
EntryPath(const EntryPath& other)

View File

@ -1,5 +1,6 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2016, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
@ -40,7 +41,9 @@ void
LocatableFile::GetPath(BString& _path) const
{
fParent->GetPath(_path);
_path << '/' << fName;
if (_path.Length() != 0)
_path << '/';
_path << fName;
}