Skip to content

Commit 40b4af9

Browse files
Use absolute paths in #line directives generated
Multiple .ino files in a sketch are concatenated together, adding #line directives so error messages refer to the original filenames. However, these directives used plain filenames, without a path. Since these filenames end up in the debug info as-is, this complicates using a debugger on the resulting .elf file. Using full pathnames fixes this. This fixes arduino/Arduino#3746. Signed-off-by: Matthijs Kooijman <[email protected]>
1 parent 00364c0 commit 40b4af9

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Diff for: src/arduino.cc/builder/sketch_source_merger.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ package builder
3232
import (
3333
"arduino.cc/builder/constants"
3434
"arduino.cc/builder/types"
35-
"path/filepath"
3635
)
3736

3837
type SketchSourceMerger struct{}
@@ -52,7 +51,7 @@ func (s *SketchSourceMerger) Run(context map[string]interface{}) error {
5251
}
5352

5453
func addPreprocLine(sketch *types.SketchFile) string {
55-
source := "#line 1 \"" + filepath.Base(sketch.Name) + "\"\n"
54+
source := "#line 1 \"" + sketch.Name + "\"\n"
5655
source += sketch.Source
5756
source += "\n"
5857

0 commit comments

Comments
 (0)