<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/lldb/test/API/commands/thread/select/TestThreadSelect.py, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>Add option to pass thread ID to thread select command (#73596)</title>
<updated>2023-12-14T23:19:38+00:00</updated>
<author>
<name>Michael Christensen</name>
<email>chmdko@gmail.com</email>
</author>
<published>2023-12-14T23:19:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=405194257506685ca11848fbaff79c4333c18c3b'/>
<id>405194257506685ca11848fbaff79c4333c18c3b</id>
<content type='text'>
We'd like a way to select the current thread by its thread ID (rather
than its internal LLDB thread index).

This PR adds a `-t` option (`--thread_id` long option) that tells the
`thread select` command to interpret the `&lt;thread-index&gt;` argument as a
thread ID.

Here's an example of it working:
```
michristensen@devbig356 llvm/llvm-project (thread-select-tid) » ../Debug/bin/lldb ~/scratch/cpp/threading/a.out
(lldb) target create "/home/michristensen/scratch/cpp/threading/a.out"
Current executable set to '/home/michristensen/scratch/cpp/threading/a.out' (x86_64).
(lldb) b 18
Breakpoint 1: where = a.out`main + 80 at main.cpp:18:12, address = 0x0000000000000850
(lldb) run
Process 215715 launched: '/home/michristensen/scratch/cpp/threading/a.out' (x86_64)
This is a thread, i=1
This is a thread, i=2
This is a thread, i=3
This is a thread, i=4
This is a thread, i=5
Process 215715 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x0000555555400850 a.out`main at main.cpp:18:12
   15     for (int i = 0; i &lt; 5; i++) {
   16       pthread_create(&amp;thread_ids[i], NULL, foo, NULL);
   17     }
-&gt; 18     for (int i = 0; i &lt; 5; i++) {
   19       pthread_join(thread_ids[i], NULL);
   20     }
   21     return 0;
(lldb) thread select 2
* thread #2, name = 'a.out'
    frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
-&gt;  0x7ffff68f9918 &lt;+72&gt;: cmpq   $-0x1000, %rax ; imm = 0xF000
    0x7ffff68f991e &lt;+78&gt;: ja     0x7ffff68f9952 ; &lt;+130&gt;
    0x7ffff68f9920 &lt;+80&gt;: movl   %edx, %edi
    0x7ffff68f9922 &lt;+82&gt;: movl   %eax, 0xc(%rsp)
(lldb) thread info
thread #2: tid = 216047, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out'

(lldb) thread list
Process 215715 stopped
  thread #1: tid = 215715, 0x0000555555400850 a.out`main at main.cpp:18:12, name = 'a.out', stop reason = breakpoint 1.1
* thread #2: tid = 216047, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out'
  thread #3: tid = 216048, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out'
  thread #4: tid = 216049, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out'
  thread #5: tid = 216050, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out'
  thread #6: tid = 216051, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out'
(lldb) thread select 215715
error: invalid thread #215715.
(lldb) thread select -t 215715
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x0000555555400850 a.out`main at main.cpp:18:12
   15     for (int i = 0; i &lt; 5; i++) {
   16       pthread_create(&amp;thread_ids[i], NULL, foo, NULL);
   17     }
-&gt; 18     for (int i = 0; i &lt; 5; i++) {
   19       pthread_join(thread_ids[i], NULL);
   20     }
   21     return 0;
(lldb) thread select -t 216051
* thread #6, name = 'a.out'
    frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
-&gt;  0x7ffff68f9918 &lt;+72&gt;: cmpq   $-0x1000, %rax ; imm = 0xF000
    0x7ffff68f991e &lt;+78&gt;: ja     0x7ffff68f9952 ; &lt;+130&gt;
    0x7ffff68f9920 &lt;+80&gt;: movl   %edx, %edi
    0x7ffff68f9922 &lt;+82&gt;: movl   %eax, 0xc(%rsp)
(lldb) thread select 3
* thread #3, name = 'a.out'
    frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
-&gt;  0x7ffff68f9918 &lt;+72&gt;: cmpq   $-0x1000, %rax ; imm = 0xF000
    0x7ffff68f991e &lt;+78&gt;: ja     0x7ffff68f9952 ; &lt;+130&gt;
    0x7ffff68f9920 &lt;+80&gt;: movl   %edx, %edi
    0x7ffff68f9922 &lt;+82&gt;: movl   %eax, 0xc(%rsp)
(lldb) thread select -t 216048
* thread #3, name = 'a.out'
    frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
-&gt;  0x7ffff68f9918 &lt;+72&gt;: cmpq   $-0x1000, %rax ; imm = 0xF000
    0x7ffff68f991e &lt;+78&gt;: ja     0x7ffff68f9952 ; &lt;+130&gt;
    0x7ffff68f9920 &lt;+80&gt;: movl   %edx, %edi
    0x7ffff68f9922 &lt;+82&gt;: movl   %eax, 0xc(%rsp)
(lldb) thread select --thread_id 216048
* thread #3, name = 'a.out'
    frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
-&gt;  0x7ffff68f9918 &lt;+72&gt;: cmpq   $-0x1000, %rax ; imm = 0xF000
    0x7ffff68f991e &lt;+78&gt;: ja     0x7ffff68f9952 ; &lt;+130&gt;
    0x7ffff68f9920 &lt;+80&gt;: movl   %edx, %edi
    0x7ffff68f9922 &lt;+82&gt;: movl   %eax, 0xc(%rsp)
(lldb) help thread select
Change the currently selected thread.

Syntax: thread select &lt;cmd-options&gt; &lt;thread-index&gt;

Command Options Usage:
  thread select [-t] &lt;thread-index&gt;

       -t ( --thread_id )
            Provide a thread ID instead of a thread index.

     This command takes options and free-form arguments.  If your arguments
     resemble option specifiers (i.e., they start with a - or --), you must use
     ' -- ' between the end of the command options and the beginning of the
     arguments.
(lldb) c
Process 215715 resuming
Process 215715 exited with status = 0 (0x00000000)
```</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We'd like a way to select the current thread by its thread ID (rather
than its internal LLDB thread index).

This PR adds a `-t` option (`--thread_id` long option) that tells the
`thread select` command to interpret the `&lt;thread-index&gt;` argument as a
thread ID.

Here's an example of it working:
```
michristensen@devbig356 llvm/llvm-project (thread-select-tid) » ../Debug/bin/lldb ~/scratch/cpp/threading/a.out
(lldb) target create "/home/michristensen/scratch/cpp/threading/a.out"
Current executable set to '/home/michristensen/scratch/cpp/threading/a.out' (x86_64).
(lldb) b 18
Breakpoint 1: where = a.out`main + 80 at main.cpp:18:12, address = 0x0000000000000850
(lldb) run
Process 215715 launched: '/home/michristensen/scratch/cpp/threading/a.out' (x86_64)
This is a thread, i=1
This is a thread, i=2
This is a thread, i=3
This is a thread, i=4
This is a thread, i=5
Process 215715 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x0000555555400850 a.out`main at main.cpp:18:12
   15     for (int i = 0; i &lt; 5; i++) {
   16       pthread_create(&amp;thread_ids[i], NULL, foo, NULL);
   17     }
-&gt; 18     for (int i = 0; i &lt; 5; i++) {
   19       pthread_join(thread_ids[i], NULL);
   20     }
   21     return 0;
(lldb) thread select 2
* thread #2, name = 'a.out'
    frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
-&gt;  0x7ffff68f9918 &lt;+72&gt;: cmpq   $-0x1000, %rax ; imm = 0xF000
    0x7ffff68f991e &lt;+78&gt;: ja     0x7ffff68f9952 ; &lt;+130&gt;
    0x7ffff68f9920 &lt;+80&gt;: movl   %edx, %edi
    0x7ffff68f9922 &lt;+82&gt;: movl   %eax, 0xc(%rsp)
(lldb) thread info
thread #2: tid = 216047, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out'

(lldb) thread list
Process 215715 stopped
  thread #1: tid = 215715, 0x0000555555400850 a.out`main at main.cpp:18:12, name = 'a.out', stop reason = breakpoint 1.1
* thread #2: tid = 216047, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out'
  thread #3: tid = 216048, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out'
  thread #4: tid = 216049, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out'
  thread #5: tid = 216050, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out'
  thread #6: tid = 216051, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out'
(lldb) thread select 215715
error: invalid thread #215715.
(lldb) thread select -t 215715
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x0000555555400850 a.out`main at main.cpp:18:12
   15     for (int i = 0; i &lt; 5; i++) {
   16       pthread_create(&amp;thread_ids[i], NULL, foo, NULL);
   17     }
-&gt; 18     for (int i = 0; i &lt; 5; i++) {
   19       pthread_join(thread_ids[i], NULL);
   20     }
   21     return 0;
(lldb) thread select -t 216051
* thread #6, name = 'a.out'
    frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
-&gt;  0x7ffff68f9918 &lt;+72&gt;: cmpq   $-0x1000, %rax ; imm = 0xF000
    0x7ffff68f991e &lt;+78&gt;: ja     0x7ffff68f9952 ; &lt;+130&gt;
    0x7ffff68f9920 &lt;+80&gt;: movl   %edx, %edi
    0x7ffff68f9922 &lt;+82&gt;: movl   %eax, 0xc(%rsp)
(lldb) thread select 3
* thread #3, name = 'a.out'
    frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
-&gt;  0x7ffff68f9918 &lt;+72&gt;: cmpq   $-0x1000, %rax ; imm = 0xF000
    0x7ffff68f991e &lt;+78&gt;: ja     0x7ffff68f9952 ; &lt;+130&gt;
    0x7ffff68f9920 &lt;+80&gt;: movl   %edx, %edi
    0x7ffff68f9922 &lt;+82&gt;: movl   %eax, 0xc(%rsp)
(lldb) thread select -t 216048
* thread #3, name = 'a.out'
    frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
-&gt;  0x7ffff68f9918 &lt;+72&gt;: cmpq   $-0x1000, %rax ; imm = 0xF000
    0x7ffff68f991e &lt;+78&gt;: ja     0x7ffff68f9952 ; &lt;+130&gt;
    0x7ffff68f9920 &lt;+80&gt;: movl   %edx, %edi
    0x7ffff68f9922 &lt;+82&gt;: movl   %eax, 0xc(%rsp)
(lldb) thread select --thread_id 216048
* thread #3, name = 'a.out'
    frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
-&gt;  0x7ffff68f9918 &lt;+72&gt;: cmpq   $-0x1000, %rax ; imm = 0xF000
    0x7ffff68f991e &lt;+78&gt;: ja     0x7ffff68f9952 ; &lt;+130&gt;
    0x7ffff68f9920 &lt;+80&gt;: movl   %edx, %edi
    0x7ffff68f9922 &lt;+82&gt;: movl   %eax, 0xc(%rsp)
(lldb) help thread select
Change the currently selected thread.

Syntax: thread select &lt;cmd-options&gt; &lt;thread-index&gt;

Command Options Usage:
  thread select [-t] &lt;thread-index&gt;

       -t ( --thread_id )
            Provide a thread ID instead of a thread index.

     This command takes options and free-form arguments.  If your arguments
     resemble option specifiers (i.e., they start with a - or --), you must use
     ' -- ' between the end of the command options and the beginning of the
     arguments.
(lldb) c
Process 215715 resuming
Process 215715 exited with status = 0 (0x00000000)
```</pre>
</div>
</content>
</entry>
<entry>
<title>[NFC][Py Reformat] Reformat python files in lldb</title>
<updated>2023-05-25T19:54:09+00:00</updated>
<author>
<name>Jonas Devlieghere</name>
<email>jonas@devlieghere.com</email>
</author>
<published>2023-05-25T15:48:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2238dcc39358353cac21df75c3c3286ab20b8f53'/>
<id>2238dcc39358353cac21df75c3c3286ab20b8f53</id>
<content type='text'>
This is an ongoing series of commits that are reformatting our Python
code. Reformatting is done with `black` (23.1.0).

If you end up having problems merging this commit because you have made
changes to a python file, the best way to handle that is to run `git
checkout --ours &lt;yourfile&gt;` and then reformat it with black.

RFC: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style

Differential revision: https://reviews.llvm.org/D151460
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is an ongoing series of commits that are reformatting our Python
code. Reformatting is done with `black` (23.1.0).

If you end up having problems merging this commit because you have made
changes to a python file, the best way to handle that is to run `git
checkout --ours &lt;yourfile&gt;` and then reformat it with black.

RFC: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style

Differential revision: https://reviews.llvm.org/D151460
</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb][tests] Automatically call compute_mydir (NFC)</title>
<updated>2022-06-17T21:34:49+00:00</updated>
<author>
<name>Dave Lee</name>
<email>davelee.com@gmail.com</email>
</author>
<published>2022-06-17T00:38:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4cc8f2a017c76af25234afc7c380550e9c93135c'/>
<id>4cc8f2a017c76af25234afc7c380550e9c93135c</id>
<content type='text'>
Eliminate boilerplate of having each test manually assign to `mydir` by calling
`compute_mydir` in lldbtest.py.

Differential Revision: https://reviews.llvm.org/D128077
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Eliminate boilerplate of having each test manually assign to `mydir` by calling
`compute_mydir` in lldbtest.py.

Differential Revision: https://reviews.llvm.org/D128077
</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] Replace StringConvert with llvm::to_integer when parsing integer values in CommandObjects</title>
<updated>2020-07-01T15:19:31+00:00</updated>
<author>
<name>Raphael Isemann</name>
<email>teemperor@gmail.com</email>
</author>
<published>2020-07-01T15:00:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=9010cef2af0affdef774a721f6adb52a40041da5'/>
<id>9010cef2af0affdef774a721f6adb52a40041da5</id>
<content type='text'>
Summary:

This replaces the current use of LLDB's own `StringConvert` with LLVM's
`to_integer` which has a less error-prone API and doesn't use special 'error
values' to designate parsing problems.

Where needed I also added missing error handling code that prints a parsing
error instead of continuing with the error value returned from `StringConvert`
(which either gave a cryptic error message or just took the error value
performed an incorrect action with it. For example, `frame recognizer delete -1`
just deleted the frame recognizer at index 0).

Reviewers: #lldb, labath

Reviewed By: labath

Subscribers: labath, abidh, JDevlieghere

Differential Revision: https://reviews.llvm.org/D82297
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Summary:

This replaces the current use of LLDB's own `StringConvert` with LLVM's
`to_integer` which has a less error-prone API and doesn't use special 'error
values' to designate parsing problems.

Where needed I also added missing error handling code that prints a parsing
error instead of continuing with the error value returned from `StringConvert`
(which either gave a cryptic error message or just took the error value
performed an incorrect action with it. For example, `frame recognizer delete -1`
just deleted the frame recognizer at index 0).

Reviewers: #lldb, labath

Reviewed By: labath

Subscribers: labath, abidh, JDevlieghere

Differential Revision: https://reviews.llvm.org/D82297
</pre>
</div>
</content>
</entry>
</feed>
