diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-04-10 20:48:55 +0000 |
|---|---|---|
| committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-04-10 20:48:55 +0000 |
| commit | 8b3af63b8993e45b1783853a3fcf6f36bfbed81b (patch) | |
| tree | 41759d08361beda32b90e345d8033aecd2e15088 /lldb/examples | |
| parent | 66b6bb1766b3e5eea56b26fc91d03f1fccbe15e4 (diff) | |
| download | bcm5719-llvm-8b3af63b8993e45b1783853a3fcf6f36bfbed81b.tar.gz bcm5719-llvm-8b3af63b8993e45b1783853a3fcf6f36bfbed81b.zip | |
[NFC] Remove ASCII lines from comments
A lot of comments in LLDB are surrounded by an ASCII line to delimit the
begging and end of the comment.
Its use is not really consistent across the code base, sometimes the
lines are longer, sometimes they are shorter and sometimes they are
omitted. Furthermore, it looks kind of weird with the 80 column limit,
where the comment actually extends past the line, but not by much.
Furthermore, when /// is used for Doxygen comments, it looks
particularly odd. And when // is used, it incorrectly gives the
impression that it's actually a Doxygen comment.
I assume these lines were added to improve distinguishing between
comments and code. However, given that todays editors and IDEs do a
great job at highlighting comments, I think it's worth to drop this for
the sake of consistency. The alternative is fixing all the
inconsistencies, which would create a lot more churn.
Differential revision: https://reviews.llvm.org/D60508
llvm-svn: 358135
Diffstat (limited to 'lldb/examples')
| -rw-r--r-- | lldb/examples/darwin/heap_find/heap/heap_find.cpp | 36 | ||||
| -rw-r--r-- | lldb/examples/functions/main.cpp | 2 | ||||
| -rw-r--r-- | lldb/examples/interposing/darwin/fd_interposing/FDInterposing.cpp | 46 | ||||
| -rw-r--r-- | lldb/examples/lookup/main.cpp | 2 |
4 files changed, 0 insertions, 86 deletions
diff --git a/lldb/examples/darwin/heap_find/heap/heap_find.cpp b/lldb/examples/darwin/heap_find/heap/heap_find.cpp index ce1bbee09cf..b7122156041 100644 --- a/lldb/examples/darwin/heap_find/heap/heap_find.cpp +++ b/lldb/examples/darwin/heap_find/heap/heap_find.cpp @@ -79,9 +79,7 @@ // C++ includes #include <vector> -//---------------------------------------------------------------------- // Redefine private types from "/usr/local/include/stack_logging.h" -//---------------------------------------------------------------------- typedef struct { uint32_t type_flags; uint64_t stack_identifier; @@ -89,9 +87,7 @@ typedef struct { mach_vm_address_t address; } mach_stack_logging_record_t; -//---------------------------------------------------------------------- // Redefine private defines from "/usr/local/include/stack_logging.h" -//---------------------------------------------------------------------- #define stack_logging_type_free 0 #define stack_logging_type_generic 1 #define stack_logging_type_alloc 2 @@ -99,10 +95,8 @@ typedef struct { // This bit is made up by this code #define stack_logging_type_vm_region 8 -//---------------------------------------------------------------------- // Redefine private function prototypes from // "/usr/local/include/stack_logging.h" -//---------------------------------------------------------------------- extern "C" kern_return_t __mach_stack_logging_set_file_path(task_t task, char *file_path); @@ -125,21 +119,15 @@ extern "C" void *gdb_class_getClass(void *objc_class); static void range_info_callback(task_t task, void *baton, unsigned type, uint64_t ptr_addr, uint64_t ptr_size); -//---------------------------------------------------------------------- // Redefine private global variables prototypes from // "/usr/local/include/stack_logging.h" -//---------------------------------------------------------------------- extern "C" int stack_logging_enable_logging; -//---------------------------------------------------------------------- // Local defines -//---------------------------------------------------------------------- #define MAX_FRAMES 1024 -//---------------------------------------------------------------------- // Local Typedefs and Types -//---------------------------------------------------------------------- typedef void range_callback_t(task_t task, void *baton, unsigned type, uint64_t ptr_addr, uint64_t ptr_size); typedef void zone_callback_t(void *info, const malloc_zone_t *zone); @@ -294,10 +282,8 @@ protected: uint32_t m_size; }; -//---------------------------------------------------------------------- // A safe way to allocate memory and keep it from interfering with the // malloc enumerators. -//---------------------------------------------------------------------- void *safe_malloc(size_t n_bytes) { if (n_bytes > 0) { const int k_page_size = getpagesize(); @@ -311,9 +297,7 @@ void *safe_malloc(size_t n_bytes) { return NULL; } -//---------------------------------------------------------------------- // ObjCClasses -//---------------------------------------------------------------------- class ObjCClasses { public: ObjCClasses() : m_objc_class_ptrs(NULL), m_size(0) {} @@ -356,16 +340,12 @@ private: uint32_t m_size; }; -//---------------------------------------------------------------------- // Local global variables -//---------------------------------------------------------------------- MatchResults g_matches; MallocStackLoggingEntries g_malloc_stack_history; ObjCClasses g_objc_classes; -//---------------------------------------------------------------------- // ObjCClassInfo -//---------------------------------------------------------------------- enum HeapInfoSortType { eSortTypeNone, eSortTypeBytes, eSortTypeCount }; @@ -469,13 +449,11 @@ private: ObjCClassInfo g_objc_class_snapshot; -//---------------------------------------------------------------------- // task_peek // // Reads memory from this tasks address space. This callback is needed // by the code that iterates through all of the malloc blocks to read // the memory in this process. -//---------------------------------------------------------------------- static kern_return_t task_peek(task_t task, vm_address_t remote_address, vm_size_t size, void **local_memory) { *local_memory = (void *)remote_address; @@ -534,12 +512,10 @@ static const void foreach_zone_in_this_process(range_callback_info_t *info) { } } -//---------------------------------------------------------------------- // dump_malloc_block_callback // // A simple callback that will dump each malloc block and all available // info from the enumeration callback perspective. -//---------------------------------------------------------------------- static void dump_malloc_block_callback(task_t task, void *baton, unsigned type, uint64_t ptr_addr, uint64_t ptr_size) { printf("task = 0x%4.4x: baton = %p, type = %u, ptr_addr = 0x%llx + 0x%llu\n", @@ -739,12 +715,10 @@ malloc_stack_entry *get_stack_history_for_address(const void *addr, return g_malloc_stack_history.data(); } -//---------------------------------------------------------------------- // find_pointer_in_heap // // Finds a pointer value inside one or more currently valid malloc // blocks. -//---------------------------------------------------------------------- malloc_match *find_pointer_in_heap(const void *addr, int check_vm_regions) { g_matches.clear(); // Setup "info" to look for a malloc block that contains data @@ -767,12 +741,10 @@ malloc_match *find_pointer_in_heap(const void *addr, int check_vm_regions) { return g_matches.data(); } -//---------------------------------------------------------------------- // find_pointer_in_memory // // Finds a pointer value inside one or more currently valid malloc // blocks. -//---------------------------------------------------------------------- malloc_match *find_pointer_in_memory(uint64_t memory_addr, uint64_t memory_size, const void *addr) { g_matches.clear(); @@ -793,13 +765,11 @@ malloc_match *find_pointer_in_memory(uint64_t memory_addr, uint64_t memory_size, return g_matches.data(); } -//---------------------------------------------------------------------- // find_objc_objects_in_memory // // Find all instances of ObjC classes 'c', or all ObjC classes if 'c' is // NULL. If 'c' is non NULL, then also check objects to see if they // inherit from 'c' -//---------------------------------------------------------------------- malloc_match *find_objc_objects_in_memory(void *isa, int check_vm_regions) { g_matches.clear(); if (g_objc_classes.Update()) { @@ -819,12 +789,10 @@ malloc_match *find_objc_objects_in_memory(void *isa, int check_vm_regions) { return g_matches.data(); } -//---------------------------------------------------------------------- // get_heap_info // // Gather information for all allocations on the heap and report // statistics. -//---------------------------------------------------------------------- void get_heap_info(int sort_type) { if (g_objc_classes.Update()) { @@ -859,11 +827,9 @@ void get_heap_info(int sort_type) { } } -//---------------------------------------------------------------------- // find_cstring_in_heap // // Finds a C string inside one or more currently valid malloc blocks. -//---------------------------------------------------------------------- malloc_match *find_cstring_in_heap(const char *s, int check_vm_regions) { g_matches.clear(); if (s == NULL || s[0] == '\0') { @@ -887,11 +853,9 @@ malloc_match *find_cstring_in_heap(const char *s, int check_vm_regions) { return g_matches.data(); } -//---------------------------------------------------------------------- // find_block_for_address // // Find the malloc block that whose address range contains "addr". -//---------------------------------------------------------------------- malloc_match *find_block_for_address(const void *addr, int check_vm_regions) { g_matches.clear(); // Setup "info" to look for a malloc block that contains data diff --git a/lldb/examples/functions/main.cpp b/lldb/examples/functions/main.cpp index cf33f37479e..07fb206f8b1 100644 --- a/lldb/examples/functions/main.cpp +++ b/lldb/examples/functions/main.cpp @@ -29,7 +29,6 @@ using namespace lldb; -//---------------------------------------------------------------------- // This quick sample code shows how to create a debugger instance and // create an executable target without adding dependent shared // libraries. It will then set a regular expression breakpoint to get @@ -47,7 +46,6 @@ using namespace lldb; // // $ DYLD_FRAMEWORK_PATH=/Volumes/data/lldb/tot/build/Debug ./a.out // executable_path1 [executable_path2 ...] -//---------------------------------------------------------------------- class LLDBSentry { public: LLDBSentry() { diff --git a/lldb/examples/interposing/darwin/fd_interposing/FDInterposing.cpp b/lldb/examples/interposing/darwin/fd_interposing/FDInterposing.cpp index efcb9bdfc07..e3f429cdf30 100644 --- a/lldb/examples/interposing/darwin/fd_interposing/FDInterposing.cpp +++ b/lldb/examples/interposing/darwin/fd_interposing/FDInterposing.cpp @@ -68,11 +68,9 @@ #include <unistd.h> #include <vector> -//---------------------------------------------------------------------- /// \def DISALLOW_COPY_AND_ASSIGN(TypeName) /// Macro definition for easily disallowing copy constructor and /// assignment operators in C++ classes. -//---------------------------------------------------------------------- #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName &); \ const TypeName &operator=(const TypeName &) @@ -87,10 +85,8 @@ int __open_extended(const char *, int, uid_t, gid_t, int, namespace fd_interposing { -//---------------------------------------------------------------------- // String class so we can get formatted strings without having to worry // about the memory storage since it will allocate the memory it needs. -//---------------------------------------------------------------------- class String { public: String() : m_str(NULL) {} @@ -142,23 +138,19 @@ private: DISALLOW_COPY_AND_ASSIGN(String); }; -//---------------------------------------------------------------------- // Type definitions -//---------------------------------------------------------------------- typedef std::vector<void *> Frames; class FDEvent; typedef std::vector<void *> Frames; typedef std::tr1::shared_ptr<FDEvent> FDEventSP; typedef std::tr1::shared_ptr<String> StringSP; -//---------------------------------------------------------------------- // FDEvent // // A class that describes a file desciptor event. // // File descriptor events fall into one of two categories: create events // and delete events. -//---------------------------------------------------------------------- class FDEvent { public: FDEvent(int fd, int err, const StringSP &string_sp, bool is_create, @@ -204,11 +196,9 @@ private: bool m_is_create; }; -//---------------------------------------------------------------------- // Templatized class that will save errno only if the "value" it is // constructed with is equal to INVALID. When the class goes out of // scope, it will restore errno if it was saved. -//---------------------------------------------------------------------- template <int INVALID> class Errno { public: // Save errno only if we are supposed to @@ -235,9 +225,7 @@ typedef Errno<-1> NegativeErrorErrno; typedef std::vector<FDEventSP> FDEventArray; typedef std::map<int, FDEventArray> FDEventMap; -//---------------------------------------------------------------------- // Globals -//---------------------------------------------------------------------- // Global event map that contains all file descriptor events. As file // descriptor create and close events come in, they will get filled // into this map (protected by g_mutex). When a file descriptor close @@ -264,10 +252,8 @@ static int g_compact = 1; // The current process ID static int g_pid = -1; static bool g_enabled = true; -//---------------------------------------------------------------------- // Mutex class that will lock a mutex when it is constructed, and unlock // it when is goes out of scope -//---------------------------------------------------------------------- class Locker { public: Locker(pthread_mutex_t *mutex_ptr) : m_mutex_ptr(mutex_ptr) { @@ -543,9 +529,7 @@ void save_backtrace(int fd, int err, const StringSP &string_sp, } } -//---------------------------------------------------------------------- // socket() interpose function -//---------------------------------------------------------------------- extern "C" int socket$__interposed__(int domain, int type, int protocol) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -572,9 +556,7 @@ extern "C" int socket$__interposed__(int domain, int type, int protocol) { } } -//---------------------------------------------------------------------- // socketpair() interpose function -//---------------------------------------------------------------------- extern "C" int socketpair$__interposed__(int domain, int type, int protocol, int fds[2]) { const int pid = get_interposed_pid(); @@ -600,9 +582,7 @@ extern "C" int socketpair$__interposed__(int domain, int type, int protocol, } } -//---------------------------------------------------------------------- // open() interpose function -//---------------------------------------------------------------------- extern "C" int open$__interposed__(const char *path, int oflag, int mode) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -631,9 +611,7 @@ extern "C" int open$__interposed__(const char *path, int oflag, int mode) { } } -//---------------------------------------------------------------------- // open$NOCANCEL() interpose function -//---------------------------------------------------------------------- extern "C" int open$NOCANCEL$__interposed__(const char *path, int oflag, int mode) { const int pid = get_interposed_pid(); @@ -654,9 +632,7 @@ extern "C" int open$NOCANCEL$__interposed__(const char *path, int oflag, } } -//---------------------------------------------------------------------- // __open_extended() interpose function -//---------------------------------------------------------------------- extern "C" int __open_extended$__interposed__(const char *path, int oflag, uid_t uid, gid_t gid, int mode, struct kauth_filesec *fsacl) { @@ -679,9 +655,7 @@ extern "C" int __open_extended$__interposed__(const char *path, int oflag, } } -//---------------------------------------------------------------------- // kqueue() interpose function -//---------------------------------------------------------------------- extern "C" int kqueue$__interposed__(void) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -699,9 +673,7 @@ extern "C" int kqueue$__interposed__(void) { } } -//---------------------------------------------------------------------- // shm_open() interpose function -//---------------------------------------------------------------------- extern "C" int shm_open$__interposed__(const char *path, int oflag, int mode) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -721,9 +693,7 @@ extern "C" int shm_open$__interposed__(const char *path, int oflag, int mode) { } } -//---------------------------------------------------------------------- // accept() interpose function -//---------------------------------------------------------------------- extern "C" int accept$__interposed__(int socket, struct sockaddr *address, socklen_t *address_len) { const int pid = get_interposed_pid(); @@ -743,9 +713,7 @@ extern "C" int accept$__interposed__(int socket, struct sockaddr *address, } } -//---------------------------------------------------------------------- // accept$NOCANCEL() interpose function -//---------------------------------------------------------------------- extern "C" int accept$NOCANCEL$__interposed__(int socket, struct sockaddr *address, socklen_t *address_len) { @@ -766,9 +734,7 @@ extern "C" int accept$NOCANCEL$__interposed__(int socket, } } -//---------------------------------------------------------------------- // dup() interpose function -//---------------------------------------------------------------------- extern "C" int dup$__interposed__(int fd2) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -787,9 +753,7 @@ extern "C" int dup$__interposed__(int fd2) { } } -//---------------------------------------------------------------------- // dup2() interpose function -//---------------------------------------------------------------------- extern "C" int dup2$__interposed__(int fd1, int fd2) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -819,9 +783,7 @@ extern "C" int dup2$__interposed__(int fd1, int fd2) { } } -//---------------------------------------------------------------------- // close() interpose function -//---------------------------------------------------------------------- extern "C" int close$__interposed__(int fd) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -859,9 +821,7 @@ extern "C" int close$__interposed__(int fd) { } } -//---------------------------------------------------------------------- // close$NOCANCEL() interpose function -//---------------------------------------------------------------------- extern "C" int close$NOCANCEL$__interposed__(int fd) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -900,9 +860,7 @@ extern "C" int close$NOCANCEL$__interposed__(int fd) { } } -//---------------------------------------------------------------------- // pipe() interpose function -//---------------------------------------------------------------------- extern "C" int pipe$__interposed__(int fds[2]) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -926,7 +884,6 @@ extern "C" int pipe$__interposed__(int fds[2]) { } } -//---------------------------------------------------------------------- // get_fd_history() // // This function allows runtime access to the file descriptor history. @@ -936,7 +893,6 @@ extern "C" int pipe$__interposed__(int fds[2]) { // // @param[in] fd // The file descriptor whose history should be dumped -//---------------------------------------------------------------------- extern "C" void get_fd_history(int log_fd, int fd) { // "create" below needs to be outside of the mutex locker scope if (log_fd >= 0) { @@ -960,9 +916,7 @@ extern "C" void get_fd_history(int log_fd, int fd) { } } -//---------------------------------------------------------------------- // Interposing -//---------------------------------------------------------------------- // FD creation routines DYLD_INTERPOSE(accept$__interposed__, accept); DYLD_INTERPOSE(accept$NOCANCEL$__interposed__, accept$NOCANCEL); diff --git a/lldb/examples/lookup/main.cpp b/lldb/examples/lookup/main.cpp index 55d0647269f..4c6daebaf1d 100644 --- a/lldb/examples/lookup/main.cpp +++ b/lldb/examples/lookup/main.cpp @@ -29,7 +29,6 @@ using namespace lldb; -//---------------------------------------------------------------------- // This quick sample code shows how to create a debugger instance and // create an "i386" executable target. Then we can lookup the executable // module and resolve a file address into a section offset address, @@ -45,7 +44,6 @@ using namespace lldb; // // $ DYLD_FRAMEWORK_PATH=/Volumes/data/lldb/svn/ToT/build/Debug ./a.out // executable_path file_address -//---------------------------------------------------------------------- class LLDBSentry { public: LLDBSentry() { |

