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

Side by Side Diff: base/debug/stack_trace_posix.cc

Issue 168643002: Convert scoped_ptr_malloc -> scoped_ptr, part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/file_util.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/debug/stack_trace.h" 5 #include "base/debug/stack_trace.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <execinfo.h> 8 #include <execinfo.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <signal.h> 10 #include <signal.h>
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 std::string::size_type mangled_end = 79 std::string::size_type mangled_end =
80 text->find_first_not_of(kSymbolCharacters, mangled_start); 80 text->find_first_not_of(kSymbolCharacters, mangled_start);
81 if (mangled_end == std::string::npos) { 81 if (mangled_end == std::string::npos) {
82 mangled_end = text->size(); 82 mangled_end = text->size();
83 } 83 }
84 std::string mangled_symbol = 84 std::string mangled_symbol =
85 text->substr(mangled_start, mangled_end - mangled_start); 85 text->substr(mangled_start, mangled_end - mangled_start);
86 86
87 // Try to demangle the mangled symbol candidate. 87 // Try to demangle the mangled symbol candidate.
88 int status = 0; 88 int status = 0;
89 scoped_ptr_malloc<char> demangled_symbol( 89 scoped_ptr<char, base::FreeDeleter> demangled_symbol(
90 abi::__cxa_demangle(mangled_symbol.c_str(), NULL, 0, &status)); 90 abi::__cxa_demangle(mangled_symbol.c_str(), NULL, 0, &status));
91 if (status == 0) { // Demangling is successful. 91 if (status == 0) { // Demangling is successful.
92 // Remove the mangled symbol. 92 // Remove the mangled symbol.
93 text->erase(mangled_start, mangled_end - mangled_start); 93 text->erase(mangled_start, mangled_end - mangled_start);
94 // Insert the demangled symbol. 94 // Insert the demangled symbol.
95 text->insert(mangled_start, demangled_symbol.get()); 95 text->insert(mangled_start, demangled_symbol.get());
96 // Next time, we'll start right after the demangled symbol we inserted. 96 // Next time, we'll start right after the demangled symbol we inserted.
97 search_from = mangled_start + strlen(demangled_symbol.get()); 97 search_from = mangled_start + strlen(demangled_symbol.get());
98 } else { 98 } else {
99 // Failed to demangle. Retry after the "_Z" we just found. 99 // Failed to demangle. Retry after the "_Z" we just found.
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 *ptr = *start; 547 *ptr = *start;
548 *start++ = ch; 548 *start++ = ch;
549 } 549 }
550 return buf; 550 return buf;
551 } 551 }
552 552
553 } // namespace internal 553 } // namespace internal
554 554
555 } // namespace debug 555 } // namespace debug
556 } // namespace base 556 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/file_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698