Chapters

Hide chapters

Advanced Apple Debugging & Reverse Engineering

Third Edition · iOS 12 · Swift 4.2 · Xcode 10

Before You Begin

Section 0: 3 chapters
Show chapters Hide chapters

Section III: Low Level

Section 3: 7 chapters
Show chapters Hide chapters

Section IV: Custom LLDB Commands

Section 4: 8 chapters
Show chapters Hide chapters

B. Appendix B: Python Environment Setup
Written by Derek Selander

Heads up... You're reading this book for free, with parts of this chapter shown beyond this point as scrambled text.

It’s not my place to force an IDE on you for Python development. However, if you’re actively looking for a Python editor for the Python related chapters — then we should have a little chat.

Getting Python

Good news: if you have a Mac, it automatically ships (at the time of writing) with Python version 2.7. This is the same version LLDB uses.

If, for some weird reason, you like to rm random things in Terminal and you need to reinstall Python, you can download Python here: https://www.python.org/downloads/. Make sure to download the version of Python that matches the version packaged with LLDB. If you’re not sure which version to get, you can get the LLDB Python version through Terminal:

lldb
(lldb) script import sys; print sys.version

Don’t worry about the final part of the version number. If you have 2.7.12 and LLDB quotes 2.7.10, that will work just fine.

Python text editors

A list of Python editors can be found here: https://wiki.python.org/moin/PythonEditors.

Working with the LLDB Python module

When working with Python, you’ll often import modules to execute code or classes within that module. When working with LLDB’s Python module, you’ll sometimes come across an import lldb somewhere in the script, usually right at the top.

touch ~/.bash_profile
export PYTHONPATH=/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/Python:$PYTHONPATH
Have a technical question? Want to report a bug? You can ask questions and report bugs to the book authors in our official book forum here.
© 2024 Kodeco Inc.

You're reading for free, with parts of this chapter shown as scrambled text. Unlock this book, and our entire catalogue of books and videos, with a Kodeco Personal Plan.

Unlock now