mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-28 04:25:10 +08:00
d7b30f6729
This is the continuation of what Joel proposed on: <https://sourceware.org/ml/gdb-patches/2013-12/msg00977.html> Now that I have already submitted and pushed the patch to split i386_stap_parse_special_token into two smaller functions, it is indeed simpler to understand this patch. It occurs because, on x86, triplet displacement operands are allowed (like "-4+8-20(%rbp)"), and the current parser for this expression is buggy. It does not correctly extract the register name from the expression, which leads to incorrect evaluation. The parser was also being very "generous" with the expression, so I included a few more checks to ensure that we're indeed dealing with a triplet displacement operand. This patch also includes testcases for the two different kind of expressions that can be encountered on x86: the triplet displacement (explained above) and the three-argument displacement (as in "(%rbx,%ebx,-8)"). The tests are obviously arch-dependent and are placed under gdb.arch/. Message-ID: <m3mwj1j12v.fsf@redhat.com> URL: <https://sourceware.org/ml/gdb-patches/2014-01/msg00310.html> gdb/ 2014-02-20 Sergio Durigan Junior <sergiodj@redhat.com> PR tdep/16397 * i386-tdep.c (i386_stap_parse_special_token_triplet): Check if a number comes after the + or - signs. Adjust length of register name to be extracted. gdb/testsuite/ 2014-02-20 Sergio Durigan Junior <sergiodj@redhat.com> PR tdep/16397 * gdb.arch/amd64-stap-special-operands.exp: New file. * gdb.arch/amd64-stap-three-arg-disp.S: Likewise. * gdb.arch/amd64-stap-three-arg-disp.c: Likewise. * gdb.arch/amd64-stap-triplet.S: Likewise. * gdb.arch/amd64-stap-triplet.c: Likewise.
59 lines
1.1 KiB
ArmAsm
59 lines
1.1 KiB
ArmAsm
.file "amd64-stap-three-arg-disp.c"
|
|
.text
|
|
.globl main
|
|
.type main, @function
|
|
main:
|
|
.LFB0:
|
|
.cfi_startproc
|
|
# BLOCK 2 seq:0
|
|
# PRED: ENTRY (fallthru)
|
|
pushq %rbp
|
|
.cfi_def_cfa_offset 16
|
|
.cfi_offset 6, -16
|
|
movq %rsp, %rbp
|
|
.cfi_def_cfa_register 6
|
|
movl %edi, -20(%rbp)
|
|
movq %rsi, -32(%rbp)
|
|
movl $10, -4(%rbp)
|
|
#APP
|
|
# 8 "amd64-stap-three-arg-disp.c" 1
|
|
990: nop
|
|
.pushsection .note.stapsdt,"?","note"
|
|
.balign 4
|
|
.4byte 992f-991f,994f-993f,3
|
|
991: .asciz "stapsdt"
|
|
992: .balign 4
|
|
993: .8byte 990b
|
|
.8byte _.stapsdt.base
|
|
.8byte 0
|
|
.asciz "test"
|
|
.asciz "three_arg"
|
|
.asciz "-4@-4(%rbp,%ebx,0)"
|
|
994: .balign 4
|
|
.popsection
|
|
|
|
# 0 "" 2
|
|
# 8 "amd64-stap-three-arg-disp.c" 1
|
|
.ifndef _.stapsdt.base
|
|
.pushsection .stapsdt.base,"aG","progbits",.stapsdt.base,comdat
|
|
.weak _.stapsdt.base
|
|
.hidden _.stapsdt.base
|
|
_.stapsdt.base: .space 1
|
|
.size _.stapsdt.base,1
|
|
.popsection
|
|
.endif
|
|
|
|
# 0 "" 2
|
|
#NO_APP
|
|
movl $0, %eax
|
|
movl $0, %ebx
|
|
popq %rbp
|
|
.cfi_def_cfa 7, 8
|
|
# SUCC: EXIT [100.0%]
|
|
ret
|
|
.cfi_endproc
|
|
.LFE0:
|
|
.size main, .-main
|
|
.ident "GCC: (GNU) 4.7.2 20120921 (Red Hat 4.7.2-2)"
|
|
.section .note.GNU-stack,"",@progbits
|