[lldb-dev] getting filename/line #

2018-06-21 Thread Randy Heiland via lldb-dev
I cannot figure how to get a backtrace with filenames/line #s. Suggestions?
(And if this list is not the proper one to ask such questions, please
redirect me)

On OSX with:
$ lldb --version
lldb-900.0.64
  Swift-4.0

For example:
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x0001001e7d42 libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x7fffc4d91457 libsystem_pthread.dylib`pthread_kill + 90
frame #2: 0x7fffc4c09420 libsystem_c.dylib`abort + 129
frame #3: 0x7fffc4cf8fe7 libsystem_malloc.dylib`free + 530
frame #4: 0x000100017138
pc-nb`BioFVM::Microenvironment::compute_gradient_vector(int) + 472
frame #5: 0x0001000174ca
pc-nb`BioFVM::Microenvironment::gradient_vector(int) + 42
frame #6: 0x000100021bc1
pc-nb`BioFVM::Basic_Agent::nearest_gradient(int) + 17
frame #7: 0x000100069ccc
pc-nb`chemotaxis_function(PhysiCell::Cell*, PhysiCell::Phenotype&, double)
+ 364
frame #8: 0x000100054ecc
pc-nb`PhysiCell::Cell::update_motility_vector(double) + 284
frame #9: 0x000100053262
pc-nb`PhysiCell::standard_update_cell_velocity(PhysiCell::Cell*,
PhysiCell::Phenotype&, double) + 818
frame #10: 0x000100051053 pc-nb`.omp_outlined..7 + 211
frame #11: 0x000100186043 libomp.dylib`__kmp_invoke_microtask + 147
frame #12: 0x00010015bfff libomp.dylib`__kmp_invoke_task_func + 156
frame #13: 0x00010015943c libomp.dylib`__kmp_fork_call + 5961
frame #14: 0x00010015075e libomp.dylib`__kmpc_fork_call + 192
  * frame #15: 0x000100050b0c
pc-nb`PhysiCell::Cell_Container::update_all_cells(double, double, double,
double) + 780
frame #16: 0x000100071a54 pc-nb`main + 2516
frame #17: 0x0001001c5235 libdyld.dylib`start + 1
frame #18: 0x0001001c5235 libdyld.dylib`start + 1

It would seem that my default formatting would have this:
(lldb) settings show frame-format
frame-format (format-string) = "frame #${frame.index}: ${frame.pc}{
${module.file.basename}{`${function.name-with-args}{${frame.no-debug}${function.pc-offset{
at ${line.file.basename}:${line.number}}{${function.is-optimized} [opt]}\n"

Thanks!
-Randy
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] getting filename/line #

2018-06-21 Thread Randy Heiland via lldb-dev
005 dwarf-info   [0x00013181-0x00013288)
> rw-  0x2181 0x0107 0x a.out.__DWARF.__debug_info
>   0x0006 dwarf-abbrev [0x00013288-0x00013320)
> rw-  0x2288 0x0098 0x a.out.__DWARF.__debug_abbrev
>   0x0007 dwarf-str[0x00013320-0x000133fd)
> rw-  0x2320 0x00dd 0x a.out.__DWARF.__debug_str
>   0x0008 apple-names  [0x000133fd-0x000134a9)
> rw-  0x23fd 0x00ac 0x a.out.__DWARF.__apple_names
>   0x0009 apple-namespaces [0x000134a9-0x000134cd)
> rw-  0x24a9 0x0024 0x a.out.__DWARF.__apple_namespac
>   0x000a apple-types  [0x000134cd-0x00013585)
> rw-  0x24cd 0x00b8 0x a.out.__DWARF.__apple_types
>   0x000b apple-objc   [0x000100003585-0x000135a9)
> rw-  0x2585 0x0024 0x a.out.__DWARF.__apple_objc
> (lldb)
>
> Above we can see we have __DWARF.__debug_info, __DWARF.__debug_line,
> __DWARF.__debug_str and __DWARF.__debug_abbrev. This indicates you have
> debug info.
>
>
> So to sum up: you need debug info in order to get source file and line
> information when debugging. This is done by specifying -g on the command
> line. The above steps help you to verify if you have debug info in your
> executable or shared library (replace "a.out" above with the basename of
> the executable you want to check for debug info).
>
> Greg Clayton
>
> > On Jun 21, 2018, at 8:18 AM, Randy Heiland via lldb-dev <
> lldb-dev@lists.llvm.org> wrote:
> >
> > I cannot figure how to get a backtrace with filenames/line #s.
> Suggestions? (And if this list is not the proper one to ask such questions,
> please redirect me)
> >
> > On OSX with:
> > $ lldb --version
> > lldb-900.0.64
> >   Swift-4.0
> >
> > For example:
> > (lldb) bt
> > * thread #1, queue = 'com.apple.main-thread', stop reason = signal
> SIGABRT
> > frame #0: 0x0001001e7d42 libsystem_kernel.dylib`__pthread_kill
> + 10
> > frame #1: 0x7fffc4d91457 libsystem_pthread.dylib`pthread_kill +
> 90
> > frame #2: 0x7fffc4c09420 libsystem_c.dylib`abort + 129
> > frame #3: 0x7fffc4cf8fe7 libsystem_malloc.dylib`free + 530
> > frame #4: 0x000100017138 pc-nb`BioFVM::
> Microenvironment::compute_gradient_vector(int) + 472
> > frame #5: 0x0001000174ca pc-nb`BioFVM::
> Microenvironment::gradient_vector(int) + 42
> > frame #6: 0x000100021bc1 
> > pc-nb`BioFVM::Basic_Agent::nearest_gradient(int)
> + 17
> > frame #7: 0x000100069ccc pc-nb`chemotaxis_function(PhysiCell::Cell*,
> PhysiCell::Phenotype&, double) + 364
> > frame #8: 0x000100054ecc 
> > pc-nb`PhysiCell::Cell::update_motility_vector(double)
> + 284
> > frame #9: 0x000100053262 pc-nb`PhysiCell::standard_
> update_cell_velocity(PhysiCell::Cell*, PhysiCell::Phenotype&, double) +
> 818
> > frame #10: 0x000100051053 pc-nb`.omp_outlined..7 + 211
> > frame #11: 0x000100186043 libomp.dylib`__kmp_invoke_microtask +
> 147
> > frame #12: 0x00010015bfff libomp.dylib`__kmp_invoke_task_func +
> 156
> > frame #13: 0x00010015943c libomp.dylib`__kmp_fork_call + 5961
> > frame #14: 0x00010015075e libomp.dylib`__kmpc_fork_call + 192
> >   * frame #15: 0x000100050b0c pc-nb`PhysiCell::Cell_
> Container::update_all_cells(double, double, double, double) + 780
> > frame #16: 0x000100071a54 pc-nb`main + 2516
> > frame #17: 0x0001001c5235 libdyld.dylib`start + 1
> > frame #18: 0x0001001c5235 libdyld.dylib`start + 1
> >
> > It would seem that my default formatting would have this:
> > (lldb) settings show frame-format
> > frame-format (format-string) = "frame #${frame.index}: ${frame.pc}{
> ${module.file.basename}{`${function.name-with-args}{${
> frame.no-debug}${function.pc-offset{ at ${line.file.basename}:${line.
> number}}{${function.is-optimized} [opt]}\n"
> >
> > Thanks!
> > -Randy
> > ___
> > lldb-dev mailing list
> > lldb-dev@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>
>
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev