Getting gnatdoc to produce non-rst output

I’ve tried to run the latest alire versions of gnatdoc in a project I have, and the only thing that seems to work is rst output… which includes non-standard, custom directives, so standard rst viewers don’t show anything useful.

The issues I’m having are:

  • html output leads to the following error:

    <PackageRenamingDecl ["C"] ada_lp-glpk.ads:21:4-21:35>
    raised PROGRAM_ERROR : gnatdoc-backend-html_markup.adb:274 finalize/adjust raised exception
    Load address: 0x56506460f000
    [/home/cantanima/.alire/bin/gnatdoc]
    0x565064b9a7ba gnatdoc__backend__html_markup__build_markup___finalizer.39 at ???
    0x565064b9a4c6 Gnatdoc.Backend.Html_Markup.Build_Markup at gnatdoc-backend-html_markup.adb:293
    0x565064ba9a92 Gnatdoc.Comments.Proxies.Component at gnatdoc-comments-proxies.adb:126
    111
    ...snip...
    

    However, the line numbers don’t seem to match up with the source code at the GitHub repository; e.g., line 293 of gnatdoc-backend-html_markup.adb is not in Gnatdoc.Backend.Html_Markup.Build_Markup.

  • odf and xml output both give the following error:

    raised CONSTRAINT_ERROR : gnatdoc-driver.adb:56 access check failed
    Load address: 0x564951b89000
    [/home/cantanima/.alire/bin/gnatdoc]
    0x56495203cd57 Gnatdoc.Driver at gnatdoc-driver.adb:56
    0x5649520431e3 Main at b__gnatdoc-driver.adb:5004
    ...snip...
    

    I think this error message does correspond to the source, insofar as there’s a Backend.all there.

I wasn’t able to get any farther into it than that.

Does anyone know:

  • How I might resolve any of these errors, or
  • How I might convert the output rst to html, or view the rst?

I cannot answer the first question, but regarding transforming one text format to another, Pandoc is the absolute winner, beast, magnificent piece of software in this area :slight_smile: You can give it almost any format and it will transform it into another one.

I hope it helps,
Fer

1 Like

Thanks. Maybe I’ll have to dig into the documentation more, but a preliminary run produces an html with the generic paramters, three headers (package name, “Types”, and “Subprograms”), and… that’s it. No types, no subprograms actually appear. I have different plans for today, but it may be a start.

You have to look at the version tagged 25.2, the one which is in the Alire index.

Thanks. I did notice the different branches and even looked at 25.2.0, but that was while looking into something different. :zany_face: When I looked at the code originally, I did find that function and I figured that line must be the issue, but I still have no idea what the problem is. I mean, I understand it’s a finalization issue; I just don’t know what.

(edited to add the italicized line and the last sentence.)

You can create issue on GitHub and attach your source code. It might help a lot to improve GNATdoc.

I will probably do that, but I don’t like to spam repositories with issues every time something goes wrong, so I was hoping someone else might have seen this. (I file a lot of bug reports as it is…)

It looks like an issue in the markdown parser. So, comments contains something that crash GNATdoc

Interesting. I don’t remember using much markdown in those comments. I’ll look at it again this evening (at work now), try and run gnatdoc, then see if I can produce an MWE for a bug report.

I took a quick look while on my lunch break. (Same computer, FWIW: a Fedora 41 system running Alire 2.1, having installed gnatdoc 25.2.0.) Even a basic, non-commented program crashes gnatdoc. Sample:

package Test_Gnatdoc is

end Test_Gnatdoc;

Shell command with full output:

$ gnatdoc -P test_gnatdoc.gpr 

raised PROGRAM_ERROR : gnatdoc-backend-html_markup.adb:274 finalize/adjust raised exception
Load address: 0x5563a6f06000
[/home/cantanima/.alire/bin/gnatdoc]
0x5563a74919ee gnatdoc__backend__html_markup__build_markup___finalizer.39 at ???
0x5563a74916fa Gnatdoc.Backend.Html_Markup.Build_Markup at gnatdoc-backend-html_markup.adb:293
0x5563a74a0cc6 Gnatdoc.Comments.Proxies.Component at gnatdoc-comments-proxies.adb:126
0x5563a74f950d Vss.Xml.Implementation.Template_Namespaces.Resolve at vss-xml-implementation-template_namespaces.adb:132
0x5563a74e95c8 Vss.Xml.Implementation.Template_Evaluators.Evaluate_Value at vss-xml-implementation-template_evaluators.adb:733
0x5563a74e501b Vss.Xml.Implementation.Template_Evaluators.Evaluate.Do_Start_Element at vss-xml-implementation-template_evaluators.adb:350
0x5563a74e6a83 Vss.Xml.Implementation.Template_Evaluators.Evaluate.Execute at vss-xml-implementation-template_evaluators.adb:490
0x5563a74e31ec Vss.Xml.Implementation.Template_Evaluators.Evaluate at vss-xml-implementation-template_evaluators.adb:624
0x5563a75320ca Vss.Xml.Templates.Processors.End_Element at vss-xml-templates-processors.adb:122
0x5563a753857d Vss.Xml.Xmlada_Readers.End_Element at vss-xml-xmlada_readers.adb:115
0x5563a97ac705 sax__readers__syntactic_parse__end_element.68 at ???
0x5563a97c6df7 sax__readers__syntactic_parse at ???
0x5563a97c854a sax__readers__parse at ???
0x5563a753942f Vss.Xml.Xmlada_Readers.Parse at vss-xml-xmlada_readers.adb:259
0x5563a74c789c Gnatdoc.Backend.Html.Generate_Unit_Documentation_Page at gnatdoc-backend-html.adb:998
0x5563a74c330e Gnatdoc.Backend.Html.Generate at gnatdoc-backend-html.adb:821
0x5563a73b9e27 Gnatdoc.Driver at gnatdoc-driver.adb:78
0x5563a73c01e3 Main at b__gnatdoc-driver.adb:5004
[/lib64/libc.so.6]
0x7f29152d2446
0x7f29152d2509
[/home/cantanima/.alire/bin/gnatdoc]
0x5563a73b9b53 _start at ???
0xfffffffffffffffe

Tickets filed, here and here.

BTW more uptodate binary version of gnatdoc (and gnatformat) could be found at Release 2026.0.202510141 · reznikmm/ada_language_server · GitHub

3 Likes

The problem is due to the compiler version: 14.2 works, 15.2 causes the problems. Thanks @godunko !

1 Like