aboutsummaryrefslogtreecommitdiff
path: root/src/common/linux
diff options
context:
space:
mode:
authorTobias Sargeant <tobiasjs@google.com>2017-10-18 16:39:09 +0100
committerTobias Sargeant <tobiasjs@chromium.org>2017-10-18 15:44:59 +0000
commit072f86ca83bb7138fe33f10b6380badd9ef7f065 (patch)
treec092b3f9e8788143d50211fa2e96a62148054d32 /src/common/linux
parentMove main executable handling out of procmaps parser loop. (diff)
downloadbreakpad-072f86ca83bb7138fe33f10b6380badd9ef7f065.tar.xz
Provide helper wrappers for basename(3) and dirname(3)
This hides the need to provide mutable C strings, and unifies existing basename calls and variations in a single location. Change-Id: Idfb449c47b1421f1a751efc3d7404f15f8b369ca Reviewed-on: https://chromium-review.googlesource.com/725731 Reviewed-by: Mark Mentovai <mark@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
Diffstat (limited to 'src/common/linux')
-rw-r--r--src/common/linux/dump_symbols.cc13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc
index 13a545f3..4e9afd2e 100644
--- a/src/common/linux/dump_symbols.cc
+++ b/src/common/linux/dump_symbols.cc
@@ -66,6 +66,7 @@
#include "common/linux/file_id.h"
#include "common/memory_allocator.h"
#include "common/module.h"
+#include "common/path_helper.h"
#include "common/scoped_ptr.h"
#ifndef NO_STABS_SUPPORT
#include "common/stabs_reader.h"
@@ -877,16 +878,6 @@ const char* ElfArchitecture(const typename ElfClass::Ehdr* elf_header) {
}
}
-// Return the non-directory portion of FILENAME: the portion after the
-// last slash, or the whole filename if there are no slashes.
-string BaseFileName(const string &filename) {
- // Lots of copies! basename's behavior is less than ideal.
- char* c_filename = strdup(filename.c_str());
- string base = basename(c_filename);
- free(c_filename);
- return base;
-}
-
template<typename ElfClass>
bool SanitizeDebugFile(const typename ElfClass::Ehdr* debug_elf_header,
const string& debuglink_file,
@@ -937,7 +928,7 @@ bool InitModuleForElfClass(const typename ElfClass::Ehdr* elf_header,
return false;
}
- string name = BaseFileName(obj_filename);
+ string name = google_breakpad::BaseName(obj_filename);
string os = "Linux";
// Add an extra "0" at the end. PDB files on Windows have an 'age'
// number appended to the end of the file identifier; this isn't