aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/SourceMgr.cpp
diff options
context:
space:
mode:
authorWanyi <wanyi@meta.com>2025-10-13 14:24:12 -0400
committerGitHub <noreply@github.com>2025-10-13 12:24:12 -0600
commit068e1796bac5229210f57862862e8995d4b6f009 (patch)
tree11cc0b24363f1f7ce72c7e0b8f059cf7c188653d /llvm/lib/Support/SourceMgr.cpp
parent7905ec387e7a4470255b7856c71b2ec654ac397a (diff)
downloadllvm-068e1796bac5229210f57862862e8995d4b6f009.zip
llvm-068e1796bac5229210f57862862e8995d4b6f009.tar.gz
llvm-068e1796bac5229210f57862862e8995d4b6f009.tar.bz2
[lldb][swig] Support SBFileSpec::GetPath (#162964)
# 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. >>> debugger = lldb.SBDebugger.Create() >>> debugger.SetAsync (False) >>> target = debugger.CreateTarget("~/tmp/hello") >>> target.IsValid() True >>> breakpoint = target.BreakpointCreateByName('main', 'hello') >>> breakpoint.GetNumLocations() 1 >>> process = target.LaunchSimple (None, None, os.getcwd()) >>> process.IsValid() True >>> thread = process.GetThreadAtIndex(0) >>> frame = thread.GetFrameAtIndex(0) >>> line = frame.GetLineEntry() # Important line below >>> file = line.GetFileSpec().GetPath(1024) # Important line above >>> print(file) /home/wanyi/tmp/main.cpp ``` ## Before this change ``` $ lldb (lldb) script Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D. >>> debugger = lldb.SBDebugger.Create() >>> debugger.SetAsync (False) >>> target = debugger.CreateTarget("~/tmp/hello") >>> target.IsValid() True >>> breakpoint = target.BreakpointCreateByName('main', 'hello') >>> breakpoint.GetNumLocations() 1 >>> process = target.LaunchSimple (None, None, os.getcwd()) >>> process.IsValid() True >>> thread = process.GetThreadAtIndex(0) >>> frame = thread.GetFrameAtIndex(0) >>> line = frame.GetLineEntry() >>> file = line.GetFileSpec().GetPath(1024) Traceback (most recent call last): File "<console>", line 1, in <module> TypeError: SBFileSpec.GetPath() missing 1 required positional argument: 'dst_len' >>> print(file) Traceback (most recent call last): File "<console>", line 1, in <module> NameError: name 'file' is not defined ```
Diffstat (limited to 'llvm/lib/Support/SourceMgr.cpp')
0 files changed, 0 insertions, 0 deletions