CTAGS-LANG-ASM - Online Linux Manual PageSection : 7
Updated :
Source : 6.0.0
Note : Universal Ctags
NAMEctags-lang-asm − Random notes about tagging Assembly language source code with Universal Ctags
SYNOPSISctags ... −−languages=+Asm ...
ctags ... −−language−force=Asm ...
ctags ... −−map−Asm=+.asm ...
ctags ... −−map−Asm=+.ASM ...
ctags ... −−map−Asm=+.s ...
ctags ... −−map−Asm=+.S ...
DESCRIPTIONThis man page gathers random notes about tagging assembly language source code. The parser of Universal Ctags has been extended to support the source code to be processed with GNU assembler (Gas).
PARAMETERSThe Asm parser has some parameters for adapting it to different assembler implementations. Writing a parser for assembly language source code is not easy because the syntax for the language differ depending on the implementations of assemblers and target CPU architectures. For example, in NASM, ; is a starter of a line comment. On the other hand, in Gas for i386, ; is a line separator. The parameters explained this man page are for mitigating the gaps of syntax. Use −−param−Asm.{parameter}={value} option for adjusting the value for a parameter. For example: $ ctags ... −−param−Asm.runCPreProcessor=false ...
This command line sets false to runCPreProcessor parameter. −−list−params=Asm lists available parameters available in the Asm parser.
runCPreProcessor: running C preprocessorBy default, the CPreProcessor parser processes the assembly language source code before the Asm parser does. The main effects of running the CPreProcessor parser; • lines started from // are stripped as comments, • areas surrounded by the pair of /* and */ are started as comments, and • macros defined with #define are extracted as tags. Set runCPreProcessor to false for disabling the CPreProcessor parser running before the Asm parser.
commentCharsAtBOL: adjusting line comment starter at the beginning of lineBy default, the Asm parser ignores lines starting from ;, *, or @ as comments. // is also ignored if runCPreProcessor is true. commentCharsAtBOL is for changing the characters for line comments. BOL is acronym standing for "the beginning of line." The characters act as comment starters only if they are at the beginning of lines. The next example if for assembler input using ! and > as the comment starter: $ ctags ... −−param−Asm.commentCharsAtBOL='!>' ...
commentCharsInMOL: adjusting line comment starter in the middle of lineSome dialects of assemblers support comments starting from the middle of line. A ; character starts a comment anywhere on the line in Gas for CRIS for example. commentCharsInMOL is for specifying the character for line comments. MOL is acronym standing for "the middle of line." Unlike characters specified with commentCharsAtBOL, the characters specified with commentCharsInMOL act as comment starts even if they are in the middle of lines. By default, the Asm parser has no commentCharsInMOL characters.
extraLinesepChars: adding line separatorsThe Asm parser processes its input line−oriented way. By default, the parser recognizes n as a line separator. extraLinesepChars is for adding more line separators. In Gas for AArch64, the ; character can be used as line separators. The next example for adjusting the Asm parser to the extra line separator: $ ctags ... −−param−Asm.extraLinesepChars=';' ...
EXPANDING C PREPROCESSOR MACROSThe Asm parser has the ability to expand C preprocessor macros before parsing. NOTE: Don't confuse C preprocessor macros and assembler implementation specific macros. The Asm parser expands only C preprocessor macros. Specifying following options are must for expansion: −−param−Asm.runCPreProcessor=true
−−fields=+{signature}
−−fields−CPreProcessor=+{macrodef}
With the above options, the parser expands macros defined in command line with −D option. See ctags(1) about the way to define a macro with the −D option. With −−param−CPreProcessor._expand=1 option, the parser expands macros defined in the current input file in addition to macros defined with the −D option. Though the parser expands macros, the parser doesn't extract language objects like labels as you expect. You must adjust the parser specific parameters to utilize the macro expansion feature effectively. See
An example of macro expansion"input.S" #define ENTRY(LABEL) .global LABEL ;\
LABEL
ENTRY(main):
nop
"output.tags" with "−−options=NONE −o − −−param−Asm.useCPreProcessor=1 −−param−CPreProcessor._expand=1 −−fields=+{signature} −−fields−CPreProcessor=+{macrodef} −−param−Asm.extraLinesepChars=; −−fields−CPreProcessor=+{macrodef} input.S" ENTRY input.S /^#define ENTRY(/;" d file: signature:(LABEL) macrodef:.global LABEL ;LABEL
main input.S /^ENTRY(main):$/;" l
The definition of ENTRY assumes ; is a line separator in the host assembly language. −−param−Asm.extraLinesepChars=; is for satisfying the assumption in ctags side.
Known limitationsThe parser has no ability to expand the macros defined outside of the current input file. The parser doesn't consider #undef when expanding.
SEE ALSOctags(1), Info entries for GNU assembler 0
Johanes Gumabo
Data Size : 21,836 byte
man-ctags-lang-asm.7Build : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 3 / 186,974
Visitor ID : :
Visitor IP : 18.220.7.116 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.