Skip to content

Improvement: Enable -g on all builds #873

Closed
@matthijskooijman

Description

@matthijskooijman

Currently, the -g compiler option for adding debug symbols is only passed when the optimization level is "Debug". However, I think that passing -g is always a good idea, even with higher optimization levels.

Of course, when you expect to be debugging, you can simply enable the debug optimization level for a build. However, sometimes you need to debug a production build, in particular when you cannot reproduce the problem using a debug build, or when you want to analyze a stack dump collected from some production system.

It is true that aggressive optimizations might interfere with debugging, but in practice debugging still works reasonably well (and certainly better than having no debugging symbols at all).

Also, AFAIK adding debug symbols does not affect the produced machine code, so the only downside of adding debug symbols might be that compilation is a little slower.

Implementing this would, I think, be a matter of removing the -g option from the Debug optimization levels in boards.txt (and replacing -g with -Og in its description, which is a good idea regardless). Then, the -g option can be added unconditionally in platformt.txt.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions