~aleteoryx/muditaos

9d57c2ab5a77ee8269dab39578a4b446317d5ae6 — Adam 5 years ago 48a1c00
Crash restore python script update to work with both python2 and python3 && ./run.sh update to accept more parameters (#1066)

2 files changed, 30 insertions(+), 6 deletions(-)

M run.sh
M tools/gdb_crash_extend.py
M run.sh => run.sh +28 -6
@@ 10,24 10,46 @@ GDB_ARM=$( hash arm-none-eabi-gdb-py 2> /dev/null && echo "arm-none-eabi-gdb-py"
help() 
{
cat<<EOF
Script accept one parameter: build catalog
- It will accept any catalog with "build" in name
- default ${BIN_DIR} is taken
Script accepts two parameters: 
    - build* 
        build catalog, it will accept any catalog with "build" in name
    default: ${BIN_DIR} is taken

It will try tu use "arm-none-eabi-gdb-py" if exists
in path else it will use "arm-none-eabi-gdb"
    --gdb PARAM
        parameter to full gdb path, for gcc9 you can pass i.e.
        ~/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gdb-py
    default: gdb from your PATH

examples:
./run.sh build-rt1051-RelWithDebInfo/ --gdb ~/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gdb-py   // full specification
./run.sh build-rt1051-RelWithDebInfo                                                                        // binary for gdb specified
./run.sh --gdb ~/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gdb-py                                // gdb binary specified
./run.sh                                                                                                    // full defaults
./run.sh --help                                                                                             // help
EOF
}

while [[ $# -gt 0 ]]; do
    echo "PARAM: $1"
    case $1 in
        build*)
            BIN_DIR="$1"
            ;;
        *)
        --gdb)
            GDB_ARM="$2"
            echo "Loaded $GDB_ARM"
            shift
            ;;
        --help)
            echo "HELP!"
            help
            exit 0
            ;;
        *)
            echo "Bad param! $1"
            help
            exit 1
            ;;
    esac;
    shift
done

M tools/gdb_crash_extend.py => tools/gdb_crash_extend.py +2 -0
@@ 1,6 1,8 @@
# Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
# For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

from __future__ import print_function

from gdb.printing import PrettyPrinter, register_pretty_printer
import gdb
import uuid