-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Fix argument annotations to show only on source registers #24192 #24719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| NAME=Register argument annotations show on sources not destinations (AT&T) | ||
| FILE=- | ||
| CMDS=<<EOF | ||
| e asm.arch=x86 | ||
| e asm.bits=64 | ||
| e asm.syntax=att | ||
| wx 4889fa89f1 | ||
| aaa | ||
| e asm.comments=true | ||
| pd 2~mov | ||
| EOF | ||
| EXPECT=<<EOF | ||
| | 0x00000000 4889fa movq %rdi, %rdx ; arg3 | ||
| | 0x00000003 89f1 movl %esi, %ecx ; arg4 | ||
| EOF | ||
| RUN | ||
|
|
||
| NAME=Register argument annotations show on sources not destinations (Intel) | ||
| FILE=- | ||
| CMDS=<<EOF | ||
| e asm.arch=x86 | ||
| e asm.bits=64 | ||
| e asm.syntax=intel | ||
| wx 4889fa89f1 | ||
| aaa | ||
| e asm.comments=true | ||
| pd 2~mov | ||
| EOF | ||
| EXPECT=<<EOF | ||
| | 0x00000000 4889fa mov rdx, rdi ; arg1 | ||
| | 0x00000003 89f1 mov ecx, esi ; arg2 | ||
| EOF | ||
| RUN |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,18 +36,18 @@ EXPECT=<<EOF | |
| | 0x08000814 e91300f9 str x9, [var_20h] | ||
| | 0x08000818 e90308aa mov x9, x8 | ||
| | 0x0800081c e81340f9 ldr x8, [var_20h] | ||
| | 0x08000820 e21700f9 str x2, [var_28h] ; arg3 | ||
| | 0x08000824 002100f9 str x0, [x8, 0x40] ; arg1 | ||
| | 0x08000828 011d00f9 str x1, [x8, 0x38] ; arg2 | ||
| | 0x0800082c 031900f9 str x3, [x8, 0x30] ; arg4 | ||
| | 0x08000830 041500f9 str x4, [x8, 0x28] ; arg5 | ||
| | 0x08000820 e21700f9 str x2, [var_28h] | ||
| | 0x08000824 002100f9 str x0, [x8, 0x40] | ||
| | 0x08000828 011d00f9 str x1, [x8, 0x38] | ||
| | 0x0800082c 031900f9 str x3, [x8, 0x30] | ||
| | 0x08000830 041500f9 str x4, [x8, 0x28] | ||
| | 0x08000834 08000090 adrp x8, segment.ehdr ; 0x8000000; RELOC 32 .rodata @ 0x080057f8 + 0x18 | ||
| | 0x08000838 08010091 add x8, x8, 0 ; RELOC 32 .rodata @ 0x080057f8 + 0x18 ; segment.ehdr | ||
| | 0x0800083c 0001c03d ldr q0, [x8] ; segment.ehdr | ||
| | 0x08000840 2001803d str q0, [x9] | ||
| | 0x08000844 080940f9 ldr x8, [x8, 0x10] | ||
| | 0x08000848 280900f9 str x8, [x9, 0x10] | ||
| | 0x0800084c 5f0000b9 str wzr, [x2] ; arg3 | ||
| | 0x0800084c 5f0000b9 str wzr, [x2] | ||
| EOF | ||
| EXPECT_ERR=<<EOF | ||
| WARN: Poorly supported AARCH64 instruction reloc type 275 at 0x08000074 | ||
|
|
@@ -117,18 +117,18 @@ EXPECT=<<EOF | |
| | 0x00000fa8 e91300f9 str x9, [var_20h] | ||
| | 0x00000fac e90308aa mov x9, x8 | ||
| | 0x00000fb0 e81340f9 ldr x8, [var_20h] | ||
| | 0x00000fb4 e21700f9 str x2, [var_28h] ; arg3 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually this is correct. the function is saving the arguments passed as parameters into local variables. im unsure about this pr.. ill think about it before merging or not
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand your point that showing which argument is being saved can be informative. However, there are a few reasons why annotations on source registers are clearer:
For this AT&T code: leaq obj.VYeXkgjLLMrczyw7i7dJPkyAbxqgCahe, %rdx ; arg3
movb %cl, (%rax, %rdx)They found it confusing that
Before (ambiguous): movq %rdi, %rdx ; arg3 ← Which one has arg3? Both shown!After (clear): movq %rdi, %rdx ; arg1 ← Only %rdi (source) has arg1
This is actually more accurate because:
But if you disagree with this approach , i will be happy to close this PR |
||
| | 0x00000fb8 002100f9 str x0, [x8, 0x40] ; arg1 | ||
| | 0x00000fbc 011d00f9 str x1, [x8, 0x38] ; arg2 | ||
| | 0x00000fc0 031900f9 str x3, [x8, 0x30] ; arg4 | ||
| | 0x00000fc4 041500f9 str x4, [x8, 0x28] ; arg5 | ||
| | 0x00000fb4 e21700f9 str x2, [var_28h] | ||
| | 0x00000fb8 002100f9 str x0, [x8, 0x40] | ||
| | 0x00000fbc 011d00f9 str x1, [x8, 0x38] | ||
| | 0x00000fc0 031900f9 str x3, [x8, 0x30] | ||
| | 0x00000fc4 041500f9 str x4, [x8, 0x28] | ||
| | 0x00000fc8 280000b0 adrp x8, 0x5000 | ||
| | 0x00000fcc 08e13e91 add x8, x8, 0xfb8 ; str.O_n_ | ||
| | 0x00000fd0 0001c03d ldr q0, [x8] ; str.O_n_ | ||
| | 0x00000fd4 2001803d str q0, [x9] | ||
| | 0x00000fd8 080940f9 ldr x8, [x8, 0x10] | ||
| | 0x00000fdc 280900f9 str x8, [x9, 0x10] | ||
| | 0x00000fe0 5f0000b9 str wzr, [x2] ; arg3 | ||
| | 0x00000fe0 5f0000b9 str wzr, [x2] | ||
| 0x00005fb8 0x5a8a51be3e7c0a4f O.|>.Q.Z | ||
| EOF | ||
| EXPECT_ERR=<<EOF | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code is storing the values passed as arguments into the stack. thats common on arm and mips programs because this way they can reuse registers for other purposes. so imho the pr is not correct