Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: gnu: Fix debugging when GDB fails to load because of Python #38749

Merged
merged 1 commit into from
Sep 23, 2021

Commits on Sep 23, 2021

  1. cmake: gnu: Fix debugging when GDB fails to load because of Python

    GDB can be built with or without Python support. When built with Python
    support this can cause a particular problem: The gdb executable relies
    on shared libraries that are bound to a specific Python version. But
    since most Linux distributions typically ship with a single version, it
    is very difficult to choose which one to target when building GDB.
    When GDB executes, if it fails to load the shared libraries it will exit
    immediately with an error code of 127 and output resembling this:
    
    /home/carles/bin/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gdb:
    error while loading shared libraries: libpython3.8.so.1.0: cannot open
    shared object file: No such file or directory
    
    There are two known approaches to shipping multiple gdb executables:
    
    - The Zephyr SDK ships a default gdb with Python enabled, and then a
      separate gdb-no-py executable with Python disabled
    - GNU Arm Embedded ships with a default gdb with Python disabled, and an
      additional gdb-py with Python enabled
    
    To mitigate the problem of not being able to debug, fall back to a
    'gdb-no-py' if it exists whenever the standard gdb executable fails to
    even run.
    
    Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
    carlescufi committed Sep 23, 2021
    Configuration menu
    Copy the full SHA
    32df0dc View commit details
    Browse the repository at this point in the history