config/debug/gdb.in.cross
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Dec 13 23:32:39 2011 +0100 (2011-12-13)
branch1.13
changeset 2847 c0bf2319af08
parent 2703 bd2529ef6665
child 2784 258160822e35
permissions -rw-r--r--
scripts: fix dumping execution backtrace

Dumping the backtrace has been broken since changeset #652e56d6d35a:
scripts: execute each steps in a subshell

We can spawn sub-sub-shells in some cases.

The way the fault handler works is to dump the backtrace, but to avoid
printing it once for every sub-shell (which could get quite confusing),
it simply exits when it detects that it is being run in a sub-shell,
leaving to the top-level shell the work to dump the backtrace.

Because each step is executed in its own sub-shell, the variable arrays
that contain the step name, the source file and line number, are lost
when exiting the per-step sub-shell.

Hence, the backtrace is currently limited to printing only the top-level
main procedure of the shell.

Fix this thus:
- when dumping the bckatraces for the steps & the functions, remember
it was dumped, and only dump it if it was not already dumped
- at the top-level shell, print the hints

Also, rename the top-level step label.

Reported-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
(transplanted from 4193d6e6a17430a177fa88c287879c2c35e319f3)
yann@1849
     1
# Menu for the cross GDB
yann@96
     2
yann@2209
     3
config STATIC_TOOLCHAIN
yann@2209
     4
    select GDB_CROSS_STATIC if GDB_CROSS
yann@2209
     5
yann@96
     6
config GDB_CROSS
yann@96
     7
    bool
yann@96
     8
    prompt "Cross-gdb"
yann@96
     9
    default y
yann@850
    10
    select GDB_GDBSERVER if ! BARE_METAL
yann@96
    11
    help
yann@583
    12
      Build and install a cross-gdb for the target, to run on host.
yann@96
    13
yann@1849
    14
if GDB_CROSS
yann@1849
    15
yann@1915
    16
config GDB_CROSS_STATIC
yann@1915
    17
    bool
yann@1915
    18
    prompt "Build a static cross gdb"
yann@2717
    19
    select WANTS_STATIC_LINK
yann@1915
    20
    help
yann@1915
    21
      A static cross gdb can be usefull if you debug on a machine that is
yann@1915
    22
      not the one that is used to compile the toolchain.
yann@1915
    23
      
yann@1915
    24
      That way, you can share the cross-gdb without installing a toolchain
yann@1915
    25
      on every machine that will be used to debug target programs.
yann@1915
    26
yann@2703
    27
config GDB_CROSS_PYTHON
yann@2703
    28
    bool
yann@2703
    29
    prompt "Enable python scripting"
yann@2703
    30
    depends on ! GDB_CROSS_STATIC
yann@2703
    31
    default y
yann@2703
    32
    help
yann@2703
    33
      Say 'y' if you want to use Python scripting inside gdb.
yann@2703
    34
      Say 'n' if you do not want to.
yann@2703
    35
      
yann@2703
    36
      Beware that enabling Python scripting could render the gdb
yann@2703
    37
      executable non-functional if you move it to another machine.
yann@2703
    38
      Building a static gdb can help in this regard, although there
yann@2703
    39
      have been reports of problems when linking gdb to the static
yann@2703
    40
      libpython.a. This should be fixed in gdb >=7.3. YMMV.
yann@2703
    41
      
yann@1849
    42
endif # GDB_CROSS