假设我有如下函数:
# cat 003.c
int foo(int a, int b)
{
return a+b;
}
Run Code Online (Sandbox Code Playgroud)
并像这样编译它:
gcc -S 003.c
Run Code Online (Sandbox Code Playgroud)
得到以下汇编结果:
.file "003.c"
.text
.globl foo
.type foo, @function
foo:
.LFB2:
pushq %rbp
.LCFI0:
movq %rsp, %rbp
.LCFI1:
movl %edi, -4(%rbp)
movl %esi, -8(%rbp)
movl -8(%rbp), %edx
movl -4(%rbp), %eax
addl %edx, %eax
leave
ret
.LFE2:
.size foo, .-foo /* size of the function foo, how to get it?*/
Run Code Online (Sandbox Code Playgroud)
上面的最后一行确实得到了函数的大小.编译器在哪里存储大小?我可以使用C或内联asm在我的原始C程序中以某种方式获取函数的大小吗?
我定义了一个函数,并希望将该区域作为optional参数.
(defun my-grep-select(&optional beg end)
(interactive "r")
(if mark-active
(....)
(....))
Run Code Online (Sandbox Code Playgroud)
如果标记处于活动状态,我想grep缓冲区中的select chars;如果标记未激活,我想grep缓冲区中光标下的字.
但在这种情况下:我打开文件并没有选择任何东西,然后运行命令my-grep-select,emacs抱怨:
The mark is not set now, so there is no region
Run Code Online (Sandbox Code Playgroud)
我怎样才能消除这种抱怨?谢谢.
<< Intel 64和IA-32架构软件开发人员手册第2B卷:指令集参考,NZ >>说:
| Opcode* | Instruction | Op/En | 64-Bit Mode | Compat/Leg Mode | Description |
| 6A | PUSH imm8 | C | Valid | Valid | Push imm8. |
| 68 | PUSH imm16 | C | Valid | Valid | Push imm16. |
| 68 | PUSH imm32 | C | Valid | Valid | Push imm32. |
Run Code Online (Sandbox Code Playgroud)
#cat -n test.asm
1 bits 64
2
3 push byte 12
4 push word 12
5 …Run Code Online (Sandbox Code Playgroud)