<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Fix lldb to use path normalization for these listed scenarios"
href="https://bugs.llvm.org/show_bug.cgi?id=34341">34341</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Fix lldb to use path normalization for these listed scenarios
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>FreeBSD
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@lists.llvm.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>karnajitw@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Raising this PR based on the following discussion
<a href="http://lists.llvm.org/pipermail/lldb-dev/2017-August/012665.html">http://lists.llvm.org/pipermail/lldb-dev/2017-August/012665.html</a>
This issue is seen in 2 scenarios:
Scenario 1: Different source file path representation
[/home/karnajitw/lldb_test_execs/test_source_line1] $ clang -O0 -g
/home/karnajitw/lldb_test_execs///test_source_line1/main.c
/home/karnajitw/lldb_test_execs/../lldb_test_execs/test_source_line1/a/ainc.c
/home/karnajitw/lldb_test_execs/test_source_line1/a/b/binc.c
(lldb) settings set target.source-map
/home/karnajitw/lldb_test_execs///test_source_line1 /u/test/test_source_line1
(lldb) l main
File: /home/karnajitw/lldb_test_execs///test_source_line1/main.c
1 #include "a/ainc.h"
2
3 int main()
4 {
5 afn();
6
7 bfn();
8
9 return 0;
10 }
(lldb) l afn
File:
/home/karnajitw/lldb_test_execs/../lldb_test_execs/test_source_line1/a/ainc.c
(lldb) l bfn
File: /home/karnajitw/lldb_test_execs/test_source_line1/a/b/binc.c
(lldb) settings set target.source-map
/home/karnajitw/lldb_test_execs/../lldb_test_execs/test_source_line1
/u/test/test_source_line1
(lldb) l main
File: /home/karnajitw/lldb_test_execs///test_source_line1/main.c
(lldb) l afn
File:
/home/karnajitw/lldb_test_execs/../lldb_test_execs/test_source_line1/a/ainc.c
1 #include <stdio.h>
2 #include "ainc.h"
3
4 void afn()
5 {
6 printf("Hello this is afn...\n");
7 }
(lldb) l bfn
File: /home/karnajitw/lldb_test_execs/test_source_line1/a/b/binc.c
(lldb) settings set target.source-map
/home/karnajitw/lldb_test_execs/test_source_line1 /u/test/test_source_line1
(lldb) l main
File: /home/karnajitw/lldb_test_execs///test_source_line1/main.c
(lldb) l afn
File:
/home/karnajitw/lldb_test_execs/../lldb_test_execs/test_source_line1/a/ainc.c
(lldb) l bfn
File: /home/karnajitw/lldb_test_execs/test_source_line1/a/b/binc.c
1 #include <stdio.h>
2 #include "binc.h"
3
4 void bfn()
5 {
6 printf("Hello this is bfn...\n");
7 }
* We require all these 3 source mappings to list main, afn & bfn together. But
the LHS and RHS actually points to the same path. So this sould have required
only single mapping.
(lldb)
target.source-map (path-map) =
[0] "/home/karnajitw/lldb_test_execs///test_source_line1" ->
"/u/test/test_source_line1"
[1] "/home/karnajitw/lldb_test_execs/../lldb_test_execs/test_source_line1" ->
"/u/test/test_source_line1"
[2] "/home/karnajitw/lldb_test_execs/test_source_line1" ->
"/u/test/test_source_line1"
Scenario 2: Deep directory structure
$ build/bin/lldb a.out
(lldb) target create "a.out"
Current executable set to 'a.out' (x86_64).
(lldb) settings set target.source-map
/home/karnajitw/lldbtest/obj/a/b/c/d/e/app/../../../../../../../src/a/b/c/d/e/app
/home/karnajitw/app
(lldb) l main
File:
/home/karnajitw/lldbtest/obj/a/b/c/d/e/app/../../../../../../../src/a/b/c/d/e/app/main.c
1 #include "sub/subfile.h"
2
3 int main()
4 {
5 subfn();
6
7 return 0;
8 }
9
(lldb) l subfn
File:
/home/karnajitw/lldbtest/obj/a/b/c/d/e/app/sub/../../../../../../../../src/a/b/c/d/e/app/sub/subfile.c
(lldb) settings append target.source-map
/home/karnajitw/lldbtest/obj/a/b/c/d/e/app/sub/../../../../../../../../src/a/b/c/d/e/app
/home/karnajitw/app
(lldb) l subfn
File:
/home/karnajitw/lldbtest/obj/a/b/c/d/e/app/sub/../../../../../../../../src/a/b/c/d/e/app/sub/subfile.c
1 #include <stdio.h>
2 #include "subfile.h"
3
4 void subfn()
5 {
6 printf("This is subfn...\n");
7 }
8
* Similarly, this requires 2 source mappings to list both main and subfn.
(lldb) settings show target.source-map
target.source-map (path-map) =
[0]
"/home/karnajitw/lldbtest/obj/a/b/c/d/e/app/../../../../../../../src/a/b/c/d/e/app"
-> "/home/karnajitw/app"
[1]
"/home/karnajitw/lldbtest/obj/a/b/c/d/e/app/sub/../../../../../../../../src/a/b/c/d/e/app"
-> "/home/karnajitw/app"
* Jim has already given the hint to solve this issue
"There's a method in FileSpec (GetNormalizedPath) that canonicalizes paths by
doing the obvious text substitution (unwinding ..'s and removing /./ and /// ->
/, etc.) Somewhere in the comparison of the source and build paths we aren't
using this when we should do. There's also a FileSpec::Equal method that
allows a canonicalized comparison. It might be that there's just some obvious
place we should have been using that."</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>