<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/lldb/test/API/python_api/default-constructor/sb_filespec.py, branch users/ojhunt/ptrauth-additions</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>[lldb][swig] Support SBFileSpec::GetPath (#162964)</title>
<updated>2025-10-13T18:24:12+00:00</updated>
<author>
<name>Wanyi</name>
<email>wanyi@meta.com</email>
</author>
<published>2025-10-13T18:24:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=068e1796bac5229210f57862862e8995d4b6f009'/>
<id>068e1796bac5229210f57862862e8995d4b6f009</id>
<content type='text'>
# Summary
`SBFileSpec::GetPath(char *dst_path, size_t dst_len)` contains `char*`
type argument. Need to handle this for python. Fortunately there're
already similar definitions we can reuse.

# Test Plan
Start the freshly built lldb and run the following code
```
$ lldb
(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
&gt;&gt;&gt; debugger = lldb.SBDebugger.Create()
&gt;&gt;&gt; debugger.SetAsync (False)
&gt;&gt;&gt; target = debugger.CreateTarget("~/tmp/hello")
&gt;&gt;&gt; target.IsValid()
True
&gt;&gt;&gt; breakpoint = target.BreakpointCreateByName('main', 'hello')
&gt;&gt;&gt; breakpoint.GetNumLocations()
1
&gt;&gt;&gt; process = target.LaunchSimple (None, None, os.getcwd())
&gt;&gt;&gt; process.IsValid()
True
&gt;&gt;&gt; thread = process.GetThreadAtIndex(0)
&gt;&gt;&gt; frame = thread.GetFrameAtIndex(0)
&gt;&gt;&gt; line = frame.GetLineEntry()

# Important line below
&gt;&gt;&gt; file = line.GetFileSpec().GetPath(1024)
# Important line above

&gt;&gt;&gt; print(file)
/home/wanyi/tmp/main.cpp
```

## Before this change
```
$ lldb
(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
&gt;&gt;&gt; debugger = lldb.SBDebugger.Create()
&gt;&gt;&gt; debugger.SetAsync (False)
&gt;&gt;&gt; target = debugger.CreateTarget("~/tmp/hello")
&gt;&gt;&gt; target.IsValid()
True
&gt;&gt;&gt; breakpoint = target.BreakpointCreateByName('main', 'hello')
&gt;&gt;&gt; breakpoint.GetNumLocations()
1
&gt;&gt;&gt; process = target.LaunchSimple (None, None, os.getcwd())
&gt;&gt;&gt; process.IsValid()
True
&gt;&gt;&gt; thread = process.GetThreadAtIndex(0)
&gt;&gt;&gt; frame = thread.GetFrameAtIndex(0)
&gt;&gt;&gt; line = frame.GetLineEntry()
&gt;&gt;&gt; file = line.GetFileSpec().GetPath(1024)
Traceback (most recent call last):
  File "&lt;console&gt;", line 1, in &lt;module&gt;
TypeError: SBFileSpec.GetPath() missing 1 required positional argument: 'dst_len'
&gt;&gt;&gt; print(file)
Traceback (most recent call last):
  File "&lt;console&gt;", line 1, in &lt;module&gt;
NameError: name 'file' is not defined
```</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
# Summary
`SBFileSpec::GetPath(char *dst_path, size_t dst_len)` contains `char*`
type argument. Need to handle this for python. Fortunately there're
already similar definitions we can reuse.

# Test Plan
Start the freshly built lldb and run the following code
```
$ lldb
(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
&gt;&gt;&gt; debugger = lldb.SBDebugger.Create()
&gt;&gt;&gt; debugger.SetAsync (False)
&gt;&gt;&gt; target = debugger.CreateTarget("~/tmp/hello")
&gt;&gt;&gt; target.IsValid()
True
&gt;&gt;&gt; breakpoint = target.BreakpointCreateByName('main', 'hello')
&gt;&gt;&gt; breakpoint.GetNumLocations()
1
&gt;&gt;&gt; process = target.LaunchSimple (None, None, os.getcwd())
&gt;&gt;&gt; process.IsValid()
True
&gt;&gt;&gt; thread = process.GetThreadAtIndex(0)
&gt;&gt;&gt; frame = thread.GetFrameAtIndex(0)
&gt;&gt;&gt; line = frame.GetLineEntry()

# Important line below
&gt;&gt;&gt; file = line.GetFileSpec().GetPath(1024)
# Important line above

&gt;&gt;&gt; print(file)
/home/wanyi/tmp/main.cpp
```

## Before this change
```
$ lldb
(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
&gt;&gt;&gt; debugger = lldb.SBDebugger.Create()
&gt;&gt;&gt; debugger.SetAsync (False)
&gt;&gt;&gt; target = debugger.CreateTarget("~/tmp/hello")
&gt;&gt;&gt; target.IsValid()
True
&gt;&gt;&gt; breakpoint = target.BreakpointCreateByName('main', 'hello')
&gt;&gt;&gt; breakpoint.GetNumLocations()
1
&gt;&gt;&gt; process = target.LaunchSimple (None, None, os.getcwd())
&gt;&gt;&gt; process.IsValid()
True
&gt;&gt;&gt; thread = process.GetThreadAtIndex(0)
&gt;&gt;&gt; frame = thread.GetFrameAtIndex(0)
&gt;&gt;&gt; line = frame.GetLineEntry()
&gt;&gt;&gt; file = line.GetFileSpec().GetPath(1024)
Traceback (most recent call last):
  File "&lt;console&gt;", line 1, in &lt;module&gt;
TypeError: SBFileSpec.GetPath() missing 1 required positional argument: 'dst_len'
&gt;&gt;&gt; print(file)
Traceback (most recent call last):
  File "&lt;console&gt;", line 1, in &lt;module&gt;
NameError: name 'file' is not defined
```</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb][test] Remove symlink for API tests.</title>
<updated>2020-02-11T18:03:53+00:00</updated>
<author>
<name>Jordan Rupprecht</name>
<email>rupprecht@google.com</email>
</author>
<published>2020-02-11T18:01:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=99451b4453688a94c6014cac233d371ab4cc342d'/>
<id>99451b4453688a94c6014cac233d371ab4cc342d</id>
<content type='text'>
Summary: Moves lldbsuite tests to lldb/test/API.

This is a largely mechanical change, moved with the following steps:

```
rm lldb/test/API/testcases
mkdir -p lldb/test/API/{test_runner/test,tools/lldb-{server,vscode}}
mv lldb/packages/Python/lldbsuite/test/test_runner/test lldb/test/API/test_runner
for d in $(find lldb/packages/Python/lldbsuite/test/* -maxdepth 0 -type d | egrep -v "make|plugins|test_runner|tools"); do mv $d lldb/test/API; done
for d in $(find lldb/packages/Python/lldbsuite/test/tools/lldb-vscode -maxdepth 1 -mindepth 1 | grep -v ".py"); do mv $d lldb/test/API/tools/lldb-vscode; done
for d in $(find lldb/packages/Python/lldbsuite/test/tools/lldb-server -maxdepth 1 -mindepth 1 | egrep -v "gdbremote_testcase.py|lldbgdbserverutils.py|socket_packet_pump.py"); do mv $d lldb/test/API/tools/lldb-server; done
```

lldb/packages/Python/lldbsuite/__init__.py and lldb/test/API/lit.cfg.py were also updated with the new directory structure.

Reviewers: labath, JDevlieghere

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D71151
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Summary: Moves lldbsuite tests to lldb/test/API.

This is a largely mechanical change, moved with the following steps:

```
rm lldb/test/API/testcases
mkdir -p lldb/test/API/{test_runner/test,tools/lldb-{server,vscode}}
mv lldb/packages/Python/lldbsuite/test/test_runner/test lldb/test/API/test_runner
for d in $(find lldb/packages/Python/lldbsuite/test/* -maxdepth 0 -type d | egrep -v "make|plugins|test_runner|tools"); do mv $d lldb/test/API; done
for d in $(find lldb/packages/Python/lldbsuite/test/tools/lldb-vscode -maxdepth 1 -mindepth 1 | grep -v ".py"); do mv $d lldb/test/API/tools/lldb-vscode; done
for d in $(find lldb/packages/Python/lldbsuite/test/tools/lldb-server -maxdepth 1 -mindepth 1 | egrep -v "gdbremote_testcase.py|lldbgdbserverutils.py|socket_packet_pump.py"); do mv $d lldb/test/API/tools/lldb-server; done
```

lldb/packages/Python/lldbsuite/__init__.py and lldb/test/API/lit.cfg.py were also updated with the new directory structure.

Reviewers: labath, JDevlieghere

Tags: #lldb

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