This patch add the ability for the user to set a label for a target. This can be very useful when debugging targets with the same executables in the same session. Labels can be set either at the target creation in the command interpreter or at any time using the SBAPI. Target labels show up in the `target list` output, following the target index, and they also allow the user to switch targets using them. rdar://105016191 Differential Revision: https://reviews.llvm.org/D151859 Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
39 lines
945 B
Plaintext
39 lines
945 B
Plaintext
# RUN: %lldb -b -o 'settings set interpreter.stop-command-source-on-error false' -s %s 2>&1 | FileCheck %s
|
|
|
|
target create -l "ls" /bin/ls
|
|
target list
|
|
# CHECK: * target #0 (ls): /bin/ls
|
|
|
|
script lldb.target.SetLabel("")
|
|
target list
|
|
# CHECK: * target #0: /bin/ls
|
|
|
|
target create -l "cat" /bin/cat
|
|
target list
|
|
# CHECK: target #0: /bin/ls
|
|
# CHECK-NEXT: * target #1 (cat): /bin/cat
|
|
|
|
target create -l "cat" /bin/cat
|
|
# CHECK: Cannot use label 'cat' since it's set in target #1.
|
|
|
|
target create -l 42 /bin/cat
|
|
# CHECK: error: Cannot use integer as target label.
|
|
|
|
target select 0
|
|
# CHECK: * target #0: /bin/ls
|
|
# CHECK-NEXT: target #1 (cat): /bin/cat
|
|
|
|
target select cat
|
|
# CHECK: target #0: /bin/ls
|
|
# CHECK-NEXT: * target #1 (cat): /bin/cat
|
|
|
|
script lldb.target.GetLabel()
|
|
# CHECK: 'cat'
|
|
|
|
script lldb.debugger.GetTargetAtIndex(0).SetLabel('Not cat')
|
|
# CHECK: success
|
|
|
|
target list
|
|
# CHECK: target #0 (Not cat): /bin/ls
|
|
# CHECK-NEXT: * target #1 (cat): /bin/cat
|