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

Side by Side Diff: base/third_party/symbolize/symbolize.cc

Issue 2857643002: Let google::Symbolize only print address offset in sanitizer builds. (Closed)
Patch Set: test Created 3 years, 7 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 | « no previous file | content/test/content_browser_test_test.cc » ('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) 2006, Google Inc. 1 // Copyright (c) 2006, 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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 base_address, out + 1, 766 base_address, out + 1,
767 out_size - 1); 767 out_size - 1);
768 } else { 768 } else {
769 object_fd = OpenObjectFileContainingPcAndGetStartAddress(pc0, start_address, 769 object_fd = OpenObjectFileContainingPcAndGetStartAddress(pc0, start_address,
770 base_address, 770 base_address,
771 out + 1, 771 out + 1,
772 out_size - 1); 772 out_size - 1);
773 } 773 }
774 774
775 // Check whether a file name was returned. 775 // Check whether a file name was returned.
776 #if !defined(ADDRESS_SANITIZER) && !defined(LEAK_SANITIZER) && \
777 !defined(MEMORY_SANITIZER) && !defined(THREAD_SANITIZER)
776 if (object_fd < 0) { 778 if (object_fd < 0) {
779 #endif
777 if (out[1]) { 780 if (out[1]) {
778 // The object file containing PC was determined successfully however the 781 // The object file containing PC was determined successfully however the
779 // object file was not opened successfully. This is still considered 782 // object file was not opened successfully. This is still considered
780 // success because the object file name and offset are known and tools 783 // success because the object file name and offset are known and tools
781 // like asan_symbolize.py can be used for the symbolization. 784 // like asan_symbolize.py can be used for the symbolization.
782 out[out_size - 1] = '\0'; // Making sure |out| is always null-terminated. 785 out[out_size - 1] = '\0'; // Making sure |out| is always null-terminated.
783 SafeAppendString("+0x", out, out_size); 786 SafeAppendString("+0x", out, out_size);
784 SafeAppendHexNumber(pc0 - base_address, out, out_size); 787 SafeAppendHexNumber(pc0 - base_address, out, out_size);
785 SafeAppendString(")", out, out_size); 788 SafeAppendString(")", out, out_size);
786 return true; 789 return true;
787 } 790 }
788 // Failed to determine the object file containing PC. Bail out. 791 // Failed to determine the object file containing PC. Bail out.
789 return false; 792 return false;
793 #if !defined(ADDRESS_SANITIZER) && !defined(LEAK_SANITIZER) && \
794 !defined(MEMORY_SANITIZER) && !defined(THREAD_SANITIZER)
790 } 795 }
796 #endif
791 FileDescriptor wrapped_object_fd(object_fd); 797 FileDescriptor wrapped_object_fd(object_fd);
792 int elf_type = FileGetElfType(wrapped_object_fd.get()); 798 int elf_type = FileGetElfType(wrapped_object_fd.get());
793 if (elf_type == -1) { 799 if (elf_type == -1) {
794 return false; 800 return false;
795 } 801 }
796 if (g_symbolize_callback) { 802 if (g_symbolize_callback) {
797 // Run the call back if it's installed. 803 // Run the call back if it's installed.
798 // Note: relocation (and much of the rest of this code) will be 804 // Note: relocation (and much of the rest of this code) will be
799 // wrong for prelinked shared libraries and PIE executables. 805 // wrong for prelinked shared libraries and PIE executables.
800 uint64_t relocation = (elf_type == ET_DYN) ? start_address : 0; 806 uint64_t relocation = (elf_type == ET_DYN) ? start_address : 0;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 870
865 // TODO: Support other environments. 871 // TODO: Support other environments.
866 bool Symbolize(void *pc, char *out, int out_size) { 872 bool Symbolize(void *pc, char *out, int out_size) {
867 assert(0); 873 assert(0);
868 return false; 874 return false;
869 } 875 }
870 876
871 _END_GOOGLE_NAMESPACE_ 877 _END_GOOGLE_NAMESPACE_
872 878
873 #endif 879 #endif
OLDNEW
« no previous file with comments | « no previous file | content/test/content_browser_test_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698