]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libdw: Add Nim language and dwarf_srclang tests
authorMark Wielaard <mark@klomp.org>
Wed, 2 Apr 2025 11:35:31 +0000 (13:35 +0200)
committerMark Wielaard <mark@klomp.org>
Tue, 8 Apr 2025 21:18:13 +0000 (23:18 +0200)
commit4d50c9e68808cbdd22dd70c26482ec010aefcbbf
treee7db17ba5c0d3fb059cecc1424e1aeda1c68d4f2
parentf33f4c85581045ae493e7f12c6ba1bf5829d8192
libdw: Add Nim language and dwarf_srclang tests

DW_LANG_Nim and DW_LNAME_Nim were added to the DWARF languages.

While adding them, and the default lower bounds, I noticed DW_LANG_V
and DW_LANG_Algol68 where missing in srclang_to_language an internal
helper function.

Testing through the public api is not that easy since you need a
Dwarf_Die with the right attributes. So this patch adds a way to
compile an individual source file with an optional main function that
can directly access the internal/static functions.

Note that it is almost generic. But even though using .SECONDEXPANSION
I couldn't figure out how to create the equivalent of a rule starting
with %_check$(EXEEXT) target. So for now the rule has to repeated for
every new _check TEST. And there needs to be a line to tell make dist
to not expect the fake source: nodist_src_check_SOURCES = src_check.c

The new test pointed out that there were a few more bugs with
DW_LANG_Dylan and DW_LNAME_Mojo. Also fix those.

* libdw/dwarf.h: Add DW_LANG_Nim and DW_LNAME_Nim.
* libdw/Makefile.am: Add check_PROGRAMS and TESTS for
dwarf_srclang_check.
* libdw/dwarf_default_lower_bound.c
        (dwarf_default_lower_bound): Add DW_LANG_Nim.
(dwarf_language_lower_bound): Add DW_LNAME_Nim.
* libdw/dwarf_srclang.c (srclang_to_language): Handle
DW_LANG_Dylan, DW_LANG_V, DW_LANG_Algol68 and DW_LANG_Nim.
(language_to_srclang): Fix DW_LNAME_Mojo. Add DW_LNAME_Nim.
(test_lang): New function guarded by MAIN_CHECK.
(main): Likewise.

Signed-off-by: Mark Wielaard <mark@klomp.org>
libdw/Makefile.am
libdw/dwarf.h
libdw/dwarf_default_lower_bound.c
libdw/dwarf_srclang.c