# Share Your Debugging Scripts | Interrupt

**URL:** <https://community.memfault.com/t/share-your-debugging-scripts-interrupt/383>\
**Category:** Blog\
**Created:** [April 21, 2021, 5:00pm UTC](https://community.memfault.com/t/share-your-debugging-scripts-interrupt/383 "2021-04-21T17:00:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![discobot](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.memfault.com/discobot/32/1_2.png) [@discobot](https://community.memfault.com/u/discobot)\
**Post date:** [April 21, 2021, 5:00pm UTC](https://community.memfault.com/t/share-your-debugging-scripts-interrupt/383/1 "2021-04-21T17:00:12Z")

</div>

One of my favorite ways to debug is to let GDB and a set of previously written Python scripts do all the work for me. These scripts could parse the heap and data structures, investigate fault registers, and paint an accurate picture of a system at the time of a crash.

* * *
This is a companion discussion topic for the original entry at [https://interrupt.memfault.com/blog/sharing-gdb-scripts](https://interrupt.memfault.com/blog/sharing-gdb-scripts)

---

<div class="post-metadata">

**Author:** ![mastupristi](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.memfault.com/mastupristi/32/32_2.png) [@mastupristi](https://community.memfault.com/u/mastupristi)\
**Post date:** [April 24, 2021, 7:45pm UTC](https://community.memfault.com/t/share-your-debugging-scripts-interrupt/383/2 "2021-04-24T19:45:35Z")

</div>

Thanks for the interesting article  
could you please tell me the difference between `arm-none-eabi-gdb` and `arm-none-eabi-gdb-py`? I think the latter has to do with _python_ but that’s all I know.

---

<div class="post-metadata">

**Author:** ![discobot](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.memfault.com/discobot/32/1_2.png) [@discobot](https://community.memfault.com/u/discobot)\
**Post date:** [April 24, 2021, 7:45pm UTC](https://community.memfault.com/t/share-your-debugging-scripts-interrupt/383/3 "2021-04-24T19:45:36Z")

</div>



---

<div class="post-metadata">

**Author:** ![francois](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@francois](https://community.memfault.com/u/francois)\
**Post date:** [April 26, 2021, 3:27am UTC](https://community.memfault.com/t/share-your-debugging-scripts-interrupt/383/4 "2021-04-26T03:27:24Z")

</div>

> [@mastupristi](#):
>
> could you please tell me the difference between `arm-none-eabi-gdb` and `arm-none-eabi-gdb-py` ? I think the latter has to do with _python_ but that’s all I know.

In the standard ARM distribution of the compiler, `arm-none-eabi-gdb-py` is compiled with Python support and can run Python scripts. `arm-none-eabi-gdb` cannot.

---

<div class="post-metadata">

**Author:** ![jay](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.memfault.com/jay/32/132_2.png) [@jay](https://community.memfault.com/u/jay)\
**Post date:** [May 4, 2021, 12:47am UTC](https://community.memfault.com/t/share-your-debugging-scripts-interrupt/383/5 "2021-05-04T00:47:03Z")

</div>

Here’s a GDB script for dynamically loading debug symbols for TockOS userspace applications. It required a very simple modification to the kernel (not shown). I’m not proud, but it worked at the time:

```auto
# The following code breaks on hook we have added to `main.rs` and
# observes process loading. It reads the process's name & `.text`
# section address and uses that information to:
#
# 1. Infer what `.elf` file we need to load to get debug symbols for the process
# 2. Load the symbols with correct `.text` offsets so GDB knows the
# actual location of functions and data
#
# NOTE: This code does not load anything onto the chip. The processes
# are already on flash and Tock takes care of starting them.
break load_process_hook
commands
  set $APP_NAME = name.data_ptr
  # The `+ 40` below is to compensate for the fact that the Tock
  # kernel does not return the actual location of process `.text`
  # section, but the beginning of it's `APP_MEMORY` region. To fix
  # this properly, we will need to add a method to Tock's `Processes`
  # type to return the correct address.
  set $APP_TEXT = text_addr + 40
  eval "add-symbol-file apps/%s/build/cortex-m4/cortex-m4.elf %d", $APP_NAME, $APP_TEXT
  tbreak main
  tbreak __assert_func
  commands
    up 1
  end
  continue
end

```
