Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emitting debug symbols with compilation #150

Open
gbluma opened this issue Mar 9, 2020 · 1 comment
Open

Emitting debug symbols with compilation #150

gbluma opened this issue Mar 9, 2020 · 1 comment
Assignees
Labels

Comments

@gbluma
Copy link
Contributor

gbluma commented Mar 9, 2020

(Creating this as as an issue for tracking.)

There is an option on the flx program to allow emitting debug symbols.

--debug : put debug symbols in generated binaries

This doesn't appear to do anything at the moment. The option is parsed and managed by the frontend, but it doesn't appear to be passed all the way down to the compiler when building flx programs.

This should be added so we can do proper debugging with MSVC, gdb, or lldb.

@gbluma gbluma added the bug label Mar 9, 2020
@gbluma gbluma self-assigned this Mar 9, 2020
@skaller
Copy link
Member

skaller commented Mar 9, 2020

It is passed, at least sometimes. See email. For clang and gcc, -g is always on anyhow. However --debug does more, it sets optimisation to -O1. It also should impact Felix compiler, reducing inlining and so making more smaller C functions/classes. Actually --debug should just do what flx --help says: emit debug symbols, nothing more. But flx --usage=debug should do the lot.

For MSVC the toolchain says:

  method fun debug_flags () => list[string] "-g";

but i just checked and that method is never used in the toolchain :-)

I think to do this correctly, this needs to include an "emit_debug_symbols" field:

@h1 Toolchain support
@tangle toolchain_config.flx

typedef toolchain_config_t = (
  c_compiler_executable: string,
  cxx_compiler_executable: string,
  header_search_dirs: list[string],
  macros : list[string],
  library_search_dirs: list[string],
  ccflags: list[string],
  dynamic_libraries: list[string],
  static_libraries: list[string],
  debugln : string -> void
);

and then all the toolchain methods that need to would check that value, and if set, put the right switch in the shell command. But this is a BIG job, because it impacts every toolchain, will break all builds including the bootstrap, and also requires that "flx" pass the flag. Also there are other objects that invoke compilers via toolchains that would need fixing, for example, the RTL builder tool flx_build_rtl.flx

Also note, its hard to test. There are clang/gcc chains for linux and macos, and also iPhone as well as msvc. Most developers can only test one or two of these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants