Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: src/common/linux/dump_symbols.cc

Issue 1726163002: Fix building on musl libc. Base URL: https://chromium.googlesource.com/breakpad/breakpad.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/client/linux/minidump_writer/minidump_writer.h ('k') | src/common/linux/elf_core_dump.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 Google Inc. 1 // Copyright (c) 2011 Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 // number appended to the end of the file identifier; this isn't 841 // number appended to the end of the file identifier; this isn't
842 // really used or necessary on other platforms, but be consistent. 842 // really used or necessary on other platforms, but be consistent.
843 id_no_dash += '0'; 843 id_no_dash += '0';
844 return id_no_dash; 844 return id_no_dash;
845 } 845 }
846 846
847 // Return the non-directory portion of FILENAME: the portion after the 847 // Return the non-directory portion of FILENAME: the portion after the
848 // last slash, or the whole filename if there are no slashes. 848 // last slash, or the whole filename if there are no slashes.
849 string BaseFileName(const string &filename) { 849 string BaseFileName(const string &filename) {
850 // Lots of copies! basename's behavior is less than ideal. 850 // Lots of copies! basename's behavior is less than ideal.
851 char* c_filename = strdup(filename.c_str()); 851 const char *c_filename = filename.c_str();
852 string base = basename(c_filename); 852 const char *p = strrchr(c_filename, '/');
853 free(c_filename); 853 string base = p ? p+1 : c_filename;
854 return base; 854 return base;
855 } 855 }
856 856
857 template<typename ElfClass> 857 template<typename ElfClass>
858 bool SanitizeDebugFile(const typename ElfClass::Ehdr* debug_elf_header, 858 bool SanitizeDebugFile(const typename ElfClass::Ehdr* debug_elf_header,
859 const string& debuglink_file, 859 const string& debuglink_file,
860 const string& obj_filename, 860 const string& obj_filename,
861 const char* obj_file_architecture, 861 const char* obj_file_architecture,
862 const bool obj_file_is_big_endian) { 862 const bool obj_file_is_big_endian) {
863 const char* debug_architecture = 863 const char* debug_architecture =
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 MmapWrapper map_wrapper; 1000 MmapWrapper map_wrapper;
1001 void* elf_header = NULL; 1001 void* elf_header = NULL;
1002 if (!LoadELF(obj_file, &map_wrapper, &elf_header)) 1002 if (!LoadELF(obj_file, &map_wrapper, &elf_header))
1003 return false; 1003 return false;
1004 1004
1005 return ReadSymbolDataInternal(reinterpret_cast<uint8_t*>(elf_header), 1005 return ReadSymbolDataInternal(reinterpret_cast<uint8_t*>(elf_header),
1006 obj_file, debug_dirs, options, module); 1006 obj_file, debug_dirs, options, module);
1007 } 1007 }
1008 1008
1009 } // namespace google_breakpad 1009 } // namespace google_breakpad
OLDNEW
« no previous file with comments | « src/client/linux/minidump_writer/minidump_writer.h ('k') | src/common/linux/elf_core_dump.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698