Bug 90575 - -gsplit-dwarf leaves behind .dwo file in cwd
Summary: -gsplit-dwarf leaves behind .dwo file in cwd
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 9.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-22 15:01 UTC by Stephan Bergmann
Modified: 2019-05-23 11:54 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Bergmann 2019-05-22 15:01:06 UTC
At least with current GCC 9.1.1:

> $ mkdir testdir
> $ echo 'int main(void) { return 0; }' > testdir/test.c
> $ gcc -gsplit-dwarf testdir/test.c -o testdir/test
> $ ls
> testdir  test.dwo

I at least wouldn't expect the above to leave behind a test.dwo in the current working dir.
Comment 1 Richard Biener 2019-05-23 10:07:45 UTC
But that's how -gsplit-dwarf is designed.
Comment 2 Stephan Bergmann 2019-05-23 10:14:30 UTC
(In reply to Richard Biener from comment #1)
> But that's how -gsplit-dwarf is designed.

Shouldn't it then be documented where any .dwo files are stored?  At least in combination with -o in comment 0, cwd looks like a strange choice.
Comment 3 Stephan Bergmann 2019-05-23 11:42:55 UTC
Or, to put it differently:  It looks odd that while `gcc -gsplit-dwarf -c test.c -o /path/test.o` puts test.dwo next to test.o into /path/, `gcc -gsplit-dwarf test.c -o /path/test` puts it into cwd.
Comment 4 Richard Biener 2019-05-23 11:54:52 UTC
(In reply to Stephan Bergmann from comment #3)
> Or, to put it differently:  It looks odd that while `gcc -gsplit-dwarf -c
> test.c -o /path/test.o` puts test.dwo next to test.o into /path/, `gcc
> -gsplit-dwarf test.c -o /path/test` puts it into cwd.

probably a better "default" than putting it behind the temporary object
file in $TMPDIR ;)

But yeah...  another fallback would be the linker output location.

That said, -gsplit-dwarf is mostly unmaintained these days...