Project

General

Profile

Feature #4073

try to get counter and vty reference information at compile time

Added by laforge 4 months ago. Updated 3 months ago.

Status:
New
Priority:
Normal
Assignee:
Target version:
-
Start date:
06/21/2019
Due date:
% Done:

0%

Spec Reference:

Description

The existing approach of extracting counter and vty information at runtime has various disadvantages. We'd like to explore options to generate this information from the source code. Whether that's using static code analysis, an existing C parser of some form, clang, ... doesn't really matter.

The goal is to generate the same textual (asciidoc for counters, xml for VTY) format as the existing 'runtime' approach.


Related issues

Related to Cellular Network Infrastructure - Feature #4044: regenerate vty reference during release processStalled06/04/2019

History

#1 Updated by osmith 4 months ago

  • Related to Feature #4044: regenerate vty reference during release process added

#2 Updated by osmith 4 months ago

I prefer this approach to the solution we arrived in #4044 (enforce generating the documentation with each commit in jenkins' gerrit-verfication job), if it is feasible.

@Hoernchen, you have explained in detail how the issue is going yesterday on the phone. Can you post a quick summary here too? Thanks!

#3 Updated by Hoernchen 3 months ago

We want to extract this from the code, so the only reasonable choice is Clang/LLVM, more specifically LibTooling, because LibClang offers a stable API, but accessing the AST through a C interface is cumbersome. Looking for the known struct names should suffice, there is also the possibility of attaching annotations to functions and variables to augment this approach.
It's also possible to modify all build scripts to support compiling and linking everything into one large bitcode blob, and the optimizing away all unused code in order to produce one large bitcode blob that contains all vty commands (including those provided by the used libs) that can be used, but I don't think that is necessary at this point.

#4 Updated by laforge 3 months ago

On Tue, Jul 02, 2019 at 09:21:21AM +0000, Hoernchen [REDMINE] wrote:

It's also possible to modify all build scripts to support compiling and linking everything into one large bitcode blob, and the optimizing away all unused code in order to produce one large bitcode blob that contains all vty commands (including those provided by the used libs) that can be used, but I don't think that is necessary at this point.

the Osmocom user manuals include the VTY reference of the libraries used, so if I understand the above
correctly, it sounds like we need to do this 'linking everything into one bitcode blob' approach?

Alternatively, one could of course generate the reference of each library as separate xml/asciidoc and then
merge it at that point. The problem with any of these approaches is that there are tons of things in
libraries which are not actually used.

So to get the "proper" output, we would have to look at only those VTY commands and counters which are
actually registered (used) by the given program.

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)