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

Side by Side Diff: src/platform-freebsd.cc

Issue 11595004: Implement OS::DumpBacktrace() on FreeBSD. (Closed)
Patch Set: Created 8 years 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 #if (defined(__arm__) || defined(__thumb__)) 191 #if (defined(__arm__) || defined(__thumb__))
192 # if defined(CAN_USE_ARMV5_INSTRUCTIONS) 192 # if defined(CAN_USE_ARMV5_INSTRUCTIONS)
193 asm("bkpt 0"); 193 asm("bkpt 0");
194 # endif 194 # endif
195 #else 195 #else
196 asm("int $3"); 196 asm("int $3");
197 #endif 197 #endif
198 } 198 }
199 199
200 200
201 void OS::DumpBacktrace() {
202 void* trace[100];
203 int size = backtrace(trace, ARRAY_SIZE(trace));
204 char** symbols = backtrace_symbols(trace, size);
205 fprintf(stderr, "\n==== C stack trace ===============================\n\n");
206 if (size == 0) {
207 fprintf(stderr, "(empty)\n");
208 } else if (symbols == NULL) {
209 fprintf(stderr, "(no symbols)\n");
210 } else {
211 for (int i = 1; i < size; ++i) {
212 fprintf(stderr, "%2d: ", i);
213 char mangled[201];
214 if (sscanf(symbols[i], "%*[^(]%*[(]%200[^)+]", mangled) == 1) { // NOLINT
215 fprintf(stderr, "%s\n", mangled);
216 } else {
217 fprintf(stderr, "??\n");
218 }
219 }
220 }
221 fflush(stderr);
222 free(symbols);
223 }
224
225
201 class PosixMemoryMappedFile : public OS::MemoryMappedFile { 226 class PosixMemoryMappedFile : public OS::MemoryMappedFile {
202 public: 227 public:
203 PosixMemoryMappedFile(FILE* file, void* memory, int size) 228 PosixMemoryMappedFile(FILE* file, void* memory, int size)
204 : file_(file), memory_(memory), size_(size) { } 229 : file_(file), memory_(memory), size_(size) { }
205 virtual ~PosixMemoryMappedFile(); 230 virtual ~PosixMemoryMappedFile();
206 virtual void* memory() { return memory_; } 231 virtual void* memory() { return memory_; }
207 virtual int size() { return size_; } 232 virtual int size() { return size_; }
208 private: 233 private:
209 FILE* file_; 234 FILE* file_;
210 void* memory_; 235 void* memory_;
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 887
863 888
864 void Sampler::Stop() { 889 void Sampler::Stop() {
865 ASSERT(IsActive()); 890 ASSERT(IsActive());
866 SignalSender::RemoveActiveSampler(this); 891 SignalSender::RemoveActiveSampler(this);
867 SetActive(false); 892 SetActive(false);
868 } 893 }
869 894
870 895
871 } } // namespace v8::internal 896 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698