For the masses, this is https://reviews.llvm.org/D55776
On Mon, Dec 17, 2018 at 10:24 AM Davide Italiano via lldb-commits <lldb-commits@lists.llvm.org> wrote: > > Author: davide > Date: Mon Dec 17 10:21:51 2018 > New Revision: 349372 > > URL: http://llvm.org/viewvc/llvm-project?rev=349372&view=rev > Log: > Fix lldb's macosx/heap.py cstr command. > > <rdar://problem/44432167> > > Added: > lldb/trunk/lit/Heap/ > lldb/trunk/lit/Heap/Inputs/ > lldb/trunk/lit/Heap/Inputs/cstr.c > lldb/trunk/lit/Heap/heap-cstr.test > Modified: > lldb/trunk/examples/darwin/heap_find/heap.py > > Modified: lldb/trunk/examples/darwin/heap_find/heap.py > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/darwin/heap_find/heap.py?rev=349372&r1=349371&r2=349372&view=diff > ============================================================================== > --- lldb/trunk/examples/darwin/heap_find/heap.py (original) > +++ lldb/trunk/examples/darwin/heap_find/heap.py Mon Dec 17 10:21:51 2018 > @@ -1036,7 +1036,7 @@ range_callback_t range_callback = [](tas > callback_baton_t *lldb_info = (callback_baton_t *)baton; > if (lldb_info->cstr_len < ptr_size) { > const char *begin = (const char *)ptr_addr; > - const char *end = begin + ptr_size - info->cstr_len; > + const char *end = begin + ptr_size - lldb_info->cstr_len; > for (const char *s = begin; s < end; ++s) { > if ((int)memcmp(s, lldb_info->cstr, lldb_info->cstr_len) == 0) { > if (lldb_info->num_matches < MAX_MATCHES) { > > Added: lldb/trunk/lit/Heap/Inputs/cstr.c > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Heap/Inputs/cstr.c?rev=349372&view=auto > ============================================================================== > --- lldb/trunk/lit/Heap/Inputs/cstr.c (added) > +++ lldb/trunk/lit/Heap/Inputs/cstr.c Mon Dec 17 10:21:51 2018 > @@ -0,0 +1,17 @@ > +#include <stdlib.h> > + > +int main(void) { > + char *str; > + int size = 9; //strlen("patatino") + 1 > + str = (char *)malloc(sizeof(char)*size); > + *(str+0) = 'p'; > + *(str+1) = 'a'; > + *(str+2) = 't'; > + *(str+3) = 'a'; > + *(str+4) = 't'; > + *(str+5) = 'i'; > + *(str+6) = 'n'; > + *(str+7) = 'o'; > + *(str+8) = '\0'; > + return 0; > +} > > Added: lldb/trunk/lit/Heap/heap-cstr.test > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Heap/heap-cstr.test?rev=349372&view=auto > ============================================================================== > --- lldb/trunk/lit/Heap/heap-cstr.test (added) > +++ lldb/trunk/lit/Heap/heap-cstr.test Mon Dec 17 10:21:51 2018 > @@ -0,0 +1,10 @@ > +# REQUIRES: system-darwin > +# RUN: %clang %p/Inputs/cstr.c -g -o %t > +# RUN: %lldb -b -s %s -f %t | FileCheck %s > + > +br set -p return > +command script import lldb.macosx.heap > +run > +cstr "patatino" > + > +# CHECK: {{.*}}: malloc( 16) -> {{.*}} > > > _______________________________________________ > lldb-commits mailing list > lldb-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits