This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Prevent disassembly beyond symbolic boundaries


Nick,

>  Currently objdump will disassemble beyond a symbolic boundary if it
>  needs extra bytes to decode an instruction.  For example (with x86):
> 
>        .file   "foo.c"
>        .text
>        .globl  foo
>        .type   foo, @function
>    foo:
>        .byte 0x24
>        .byte 0x2f
>        .byte 0x83
>        .size   foo, .-foo
> 
>        .globl bar
>        .type bar, @function
>    bar:
>        .byte 0x0f
>        .byte 0xba
>        .byte 0xe2
>        .byte 0x03
>        .size   bar, .-bar
> 
>  This will disassemble as:
> 
>    0000000000000000 <foo>:
>       0:   24 2f                   and    $0x2f,%al
>       2:   83 0f ba                orl    $0xffffffba,(%rdi)
> 
>    0000000000000003 <bar>:
>       3:   0f ba e2 03             bt     $0x3,%edx
> 
>  Note how the instruction decoded at address 0x2 has stolen two bytes
>  from "foo", but these bytes are also decoded (correctly this time) as
>  part of the first instruction of foo.
> 
>  I have a patch (attached) which changes this behaviour, so that the
>  disassembly would be:
> 
>       0:  24 2f              	   and    $0x2f,%al
>       2:  83                      .byte 0x83
> 
>    00000003 <bar>:
>       3:  0f ba e2 03             bt     $0x3,%edx

[â]

>  What do people think ?  To me this seems like a good idea, but I
>  willing to consider alternative suggestions if people have them.

I am curious.  Why do you think it was a problem ?
Even if there is a symbol in the middle of an instruction, Iâd like
to understand what the processor will execute.  Before the proposed
change, it was possible, but after it isnât easy anymore.

(But I agree I never met this issue.  I am just curious here).

Tristan.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]