SPRUI03E June 2015 – January 2023
Mark Function Boundaries
symbol .asmfunc [stack_usage(num)]
.endasmfunc
The .asmfunc and .endasmfunc directives mark function boundaries. These directives are used with the compiler -g option (--symdebug:dwarf) to allow assembly code sections to be debugged in the same manner as C/C++ functions.
You should not use the same directives generated by the compiler (see Appendix A) to accomplish assembly debugging; those directives should be used only by the compiler to generate symbolic debugging information for C/C++ source files.
The symbol is a label that must appear in the label field.
The .asmfunc directive has an optional parameter, stack_usage, which indicates that the function may use up to num bytes.
Consecutive ranges of assembly code that are not enclosed within a pair of .asmfunc and .endasmfunc directives are given a default name in the following format:
$ filename: beginning source line: ending source line$
This example generates debug information for the userfunc section.
1 00000000 .sect ".text"
2 .global userfunc
3 .global _printf
4
5 userfunc: .asmfunc stack_usage(16)
6 00000000 00000010! CALL .S1 _printf
7 00000004 01BC94F6 STW .D2T2 B3,*B15--(16)
8 00000008 01800E2A' MVKL .S2 RL0,B3
9 0000000c 01800028+ MVKL .S1 SL1+0,A3
10 00000010 01800068+ MVKH .S1 SL1+0,A3
11
12 00000014 01BC22F5 STW .D2T1 A3,*+B15(4)
13 00000018 0180006A' || MVKH .S2 RL0,B3
14
15 0000001c 01BC92E6 RL0: LDW .D2T2 *++B15(16),B3
16 00000020 020008C0 ZERO .D1 A4
17 00000024 00004000 NOP 3
18 00000028 000C0362 RET .S2 B3
19 0000002c 00008000 NOP 5
20 .endasmfunc
21
22 00000000 .sect ".const"
23 00000000 00000048 SL1: .string "Hello World!",10,0
00000001 00000065
00000002 0000006C
00000003 0000006C
00000004 0000006F
00000005 00000020
00000006 00000057
00000007 0000006F
00000008 00000072
00000009 0000006C
0000000a 00000064
0000000b 00000021
0000000c 0000000A
0000000d 00000000