[lldb-dev] RegisterContextPOSIX_i386
Greg Clayton
gclayton at apple.com
Mon Oct 7 16:13:51 PDT 2013
Looks good.
More comments below...
On Oct 1, 2013, at 12:16 PM, Michael Sartain <mikesart at gmail.com> wrote:
> On Fri, Sep 13, 2013 at 11:33 AM, Thirumurthi, Ashok <ashok.thirumurthi at intel.com> wrote:
> One point to consider is if there is scope for some common code between architectures. Note that the list of architectures will only grow (i.e. x32). A future point is to keep POSIX-isms nicely contained. When considering platform-independent remote debugging that is consistent with native-local debugging, we'll want code consistent between platforms to live in one place.
>
> Here is a first pass at this:
>
> http://llvm-reviews.chandlerc.com/D1798
>
> It passes all the 64-bit linux tests, although there is still a bit of cleanup I need to do.
> - FreeBSD is most likely busted... (I'll contact Ed about working on this when it's a bit more nailed down.)
> - I need to check and fix dwarf / gdb constant values.
> - I don't like the ConvertRegisterKindToRegisterNumber() routines.
Do you not like how they are implemented in the register context classes for posix/linux/freebsd, or are you questioning their need?
They are needed for parsing DWARF and EH frame information and any other object file sections that contain register numbers in them. We can probably automate the ConvertRegisterKindToRegisterNumber() up into the RegisterContext base class so that it uses the RegisterInfo data to populate lookup tables, but then we might need a finalize call to let the base class know that it is ok to go ahead and compute the lookup tables.
> - Also don't like the RegisterContextPOSIXProcessMonitor_x86_64::ReadRegister() / WriteRegister() routines.
Again, do you not like how they are implemented, or would you rather see them go away? I tried to add flexibility to the register contexts so you can read/write all registers at once, or read/write single registers since things like GDB remote might support one, the other, or both. Many JTAG debuggers also read/write registers individually and it can impose quite a performance penalty to force reading/writing all registers at once (all GPRs, all FPUs, etc).
> - Need to implement RegisterContextPOSIX_i386* so 32-bit LLDB will fully work. (This may come in a second checkin).
> - Would love to have xmm00, xmm01, etc. type aliases for mmx, sse, and avx registers.
Is this more than filling out the "alt_name" field? Or is this more like the "eax" register that is part of "rax"?
>
> If anyone has any general feedback on how any of this looks and/or ideas on more cleanup, please fire away.
>
> Thanks much.
> -Mike
>
> ----
> (lldb i386 target) register read
> General Purpose Registers:
> eax = 0xffcf2354
> ebx = 0xf7605ff4
> ecx = 0x00000001
> edx = 0x08048980
> edi = 0x00000000
> esi = 0x00000000
> ebp = 0xffcf22b8
> esp = 0xffcf1f40
> eip = 0x080486b2 sse32`main + 258 at sse.cpp:40
> eflags = 0x00000282
> cs = 0x00000023
> fs = 0x00000000
> gs = 0x00000063
> ss = 0x0000002b
> ds = 0x0000002b
> es = 0x0000002b
>
> (lldb x64 target) register read
> General Purpose Registers:
> rax = 0x0000000000400ce0
> rbx = 0x0000000000000000
> rcx = 0x0000000000000040
> rdx = 0x00007fff03d15e38
> rdi = 0x0000000000000001
> rsi = 0x00007fff03d15e28
> rbp = 0x00007fff03d15d40
> rsp = 0x00007fff03d15960
> r8 = 0x0000000000400c30 sse64`__libc_csu_fini
> r9 = 0x00007fa459ca1740 ld-linux-x86-64.so.2`_dl_fini at dl-fini.c:133
> r10 = 0x00007fff03d15ba0
> r11 = 0x00007fa458cc1680 libc.so.6`__libc_start_main at libc-start.c:96
> r12 = 0x0000000000400650 sse64`_start
> r13 = 0x00007fff03d15e20
> r14 = 0x0000000000000000
> r15 = 0x0000000000000000
> rip = 0x0000000000400774 sse64`main + 52 at sse.cpp:32
> rflags = 0x0000000000000206
> cs = 0x0000000000000033
> fs = 0x0000000000000000
> gs = 0x0000000000000000
> ss = 0x000000000000002b
> ds = 0x0000000000000000
> es = 0x0000000000000000
>
> I also added a bunch of register aliases (ax, ah, al, etc.) which you can set via "register read -a".
>
> General Purpose Registers:
> eax = 0xffd22ac4
> ebx = 0xf75b7ff4
> ecx = 0x00000001
> edx = 0x08048980
> edi = 0x00000000
> esi = 0x00000000
> ebp = 0xffd22a28
> esp = 0xffd226c0
> eip = 0x080485e4 sse32`main + 52 at sse.cpp:32
> eflags = 0x00000286
> cs = 0x00000023
> fs = 0x00000000
> gs = 0x00000063
> ss = 0x0000002b
> ds = 0x0000002b
> es = 0x0000002b
> ax = 0x2ac4
> bx = 0x7ff4
> cx = 0x0001
> dx = 0x8980
> di = 0x0000
> si = 0x0000
> bp = 0x2a28
> sp = 0x26c0
> ah = 0xc4
> bh = 0xf4
> ch = 0x01
> dh = 0x80
> al = 0xc4
> bl = 0xf4
> cl = 0x01
> dl = 0x80
> dil = 0x00
> sil = 0x00
> bpl = 0x28
> spl = 0xc0
> ...
More information about the lldb-dev
mailing list