amoeba commented on issue #38519:
URL: https://github.com/apache/arrow/issues/38519#issuecomment-2347799545

   I found this issue while trying to figure out how to debug C++ code inside 
PyArrow and I think I'm seeing something similar to the above. With a debug 
Arrow C++ and PyArrow build, I can hit a breakpoint but I don't see source code 
mapping:
   
   ```sh
   (venv) bryce@debian ~/s/a/a/python (main)> lldb -- $(which python)
   Traceback (most recent call last):
     File "<string>", line 1, in <module>
   ModuleNotFoundError: No module named 'lldb'
   (lldb) target create "/home/bryce/src/apache/arrow/python/venv/bin/python"
   Current executable set to 
'/home/bryce/src/apache/arrow/python/venv/bin/python' (x86_64).
   (lldb) b ConvertPySequence
   Breakpoint 1: no locations (pending).
   WARNING:  Unable to resolve breakpoint to any actual locations.
   (lldb) run
   Process 66372 launched: 
'/home/bryce/src/apache/arrow/python/venv/bin/python' (x86_64)
   Python 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0] on linux
   Type "help", "copyright", "credits" or "license" for more information.
   >>> import pyarrow as pa
   1 location added to breakpoint 1
   warning: (x86_64) 
/home/bryce/src/apache/arrow/python/venv/lib/python3.11/site-packages/numpy.libs/libgfortran-040039e1-0352e75f.so.5.0.0
 No LZMA support found for reading .gnu_debugdata section
   >>> pa.array([1])
   Process 66372 stopped
   * thread #1, name = 'python', stop reason = breakpoint 1.1
       frame #0: 0x00007ffff6d6f510 
libarrow_python.so`arrow::py::ConvertPySequence(_object*, _object*, 
arrow::py::PyConversionOptions, arrow::MemoryPool*)
   libarrow_python.so`arrow::py::ConvertPySequence:
   ->  0x7ffff6d6f510 <+0>: pushq  %rbp
       0x7ffff6d6f511 <+1>: movq   %rsp, %rbp
       0x7ffff6d6f514 <+4>: pushq  %r15
       0x7ffff6d6f516 <+6>: movq   %rsi, %r15
   ```
   
   One thing I notice is that libarrow_python.so doesn't have debug info like 
libarrow.so:
   
   ```sh
   (venv) bryce@debian ~/s/a/a/python (main)> file pyarrow/libarrow_python.so
   pyarrow/libarrow_python.so: ELF 64-bit LSB shared object, x86-64, version 1 
(GNU/Linux), dynamically linked, 
BuildID[sha1]=be0d7e9dcfba902687a81fec19e5565c4c1d3626, not stripped
   (venv) bryce@debian ~/s/a/a/python (main)> file 
$ARROW_HOME/lib/libarrow.so.1800.0.0
   /home/bryce/builds/arrow-x86_64/lib/libarrow.so.1800.0.0: ELF 64-bit LSB 
shared object, x86-64, version 1 (GNU/Linux), dynamically linked, 
BuildID[sha1]=282a70ef10aec0f43eb1f10ed176eaa4f993fab2, with debug_info, not 
stripped
   (venv) bryce@debian ~/s/a/a/python (main)> 
   ```
   
   (In the output above, libarrow_python.so is missing the string "debug_info" 
in its output).
   
   Source code mapping is working with with symbols in Arrow C++:
   
   ```
   (lldb) b Result
   Breakpoint 2: 1093 locations.
   (lldb) run
   There is a running process, kill it and restart?: [Y/n] Y
   Process 67013 exited with status = 9 (0x00000009) 
   Process 67276 launched: 
'/home/bryce/src/apache/arrow/python/venv/bin/python' (x86_64)
   Python 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0] on linux
   Type "help", "copyright", "credits" or "license" for more information.
   >>> import pyarrow as pa
   Process 67276 stopped
   * thread #1, name = 'python', stop reason = breakpoint 2.384
       frame #0: 0x00007ffff3d31e12 
libarrow.so.1800`arrow::Result<arrow::fs::FileSystemFactoryRegistry::Registered>::Result(this=0x0000000000c7c5e8,
 value=0x00007fffffffbee0) at result.h:178:29
      175    // NOTE `Result(U&& value)` above should be sufficient, but some 
compilers
      176    // fail matching it.
      177    Result(T&& value) noexcept {  // NOLINT(runtime/explicit)
   -> 178      ConstructValue(std::move(value));
      179    }
      180 
      181    /// Copy constructor.
   ```
   
   Any ideas @kou? 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to