[lldb-dev] Problem unwinding from inside of a CRT function

Greg Clayton gclayton at apple.com
Tue Jan 20 14:59:59 PST 2015


See if you can expedite all of your GPR registers in your stop reply and qThreadStopInfo responses. We are typically slowed down by packet send/receive, so we try to minimize them by always including all registers in the stop reply and qThreadStopInfo. Otherwise we will send a p packet to read each register we need.

Below is an example from debugging TextEdit.app on MacOSX:

<   5> send packet: $c#63
send packet: \x03
< 587> read packet: $T11thread:3fe26e;qaddr:7fff77e5c480;threads:3fe26e,3fe292,3fe293,3fe294,3fe2a3,3fe2b4,3fe2c3,3fe2d2,3fe2f3,3fe56a,3fe56d;00:0540001000000000;01:ffffffff00000000;02:28e1bf5fff7f0000;03:0000000000000000;04:90e2bf5fff7f0000;05:0608000700000000;06:70e1bf5fff7f0000;07:28e1bf5fff7f0000;08:0b1b000000000000;09:ffffffff00000000;0a:000c000000000000;0b:0602000000000000;0c:000c000000000000;0d:0000000000000000;0e:90e2bf5fff7f0000;0f:0b1b000000000000;10:2e351a88ff7f0000;11:0602000000000000;12:0700000000000000;13:0000000000000000;14:0000000000000000;metype:5;mecount:2;medata:10003;medata:11;#00
SendInterrupt () - sent interrupt, private state stopped
<  25> send packet: $qThreadStopInfo3fe292#96
< 542> read packet: $T00thread:3fe292;qaddr:10009c180;threads:3fe26e,3fe292,3fe293,3fe294,3fe2a3,3fe2b4,3fe2c3,3fe2d2,3fe2f3,3fe56a,3fe56d;00:7101000200000000;01:0000000000000000;02:b8b5090001000000;03:0000000000000000;04:0300000000000000;05:0000000000000000;06:40b6090001000000;07:b8b5090001000000;08:0100000000000000;09:0000000000000000;0a:d0b5090001000000;0b:4602000000000000;0c:5892398bff7f0000;0d:c04e2077ff7f0000;0e:d0b5090001000000;0f:00b6090001000000;10:2e921a88ff7f0000;11:4602000000000000;12:0700000000000000;13:0000000000000000;14:0000000000000000;#00
<  25> send packet: $qThreadStopInfo3fe293#97
< 542> read packet: $T00thread:3fe293;qaddr:100581180;threads:3fe26e,3fe292,3fe293,3fe294,3fe2a3,3fe2b4,3fe2c3,3fe2d2,3fe2f3,3fe56a,3fe56d;00:7001000200000000;01:0000010000000000;02:180f580001000000;03:0000000000000000;04:0400000000000000;05:0000000000000000;06:500f580001000000;07:180f580001000000;08:0000000000000000;09:0000000000000000;0a:0000000000000000;0b:4602000000000000;0c:ff10008000000000;0d:0316000000000000;0e:0010580001000000;0f:1900000000000000;10:46891a88ff7f0000;11:4602000000000000;12:0700000000000000;13:0000000000000000;14:0000000000000000;#00
<  25> send packet: $qThreadStopInfo3fe294#98
< 542> read packet: $T00thread:3fe294;qaddr:100604180;threads:3fe26e,3fe292,3fe293,3fe294,3fe2a3,3fe2b4,3fe2c3,3fe2d2,3fe2f3,3fe56a,3fe56d;00:0500000200000000;01:f82d600001000000;02:f81c600001000000;03:d8490a0000000000;04:d8498a0901000000;05:0480000000000000;06:d022600001000000;07:f81c600001000000;08:0900000000000000;09:2006000000000000;0a:d8498a0901000000;0b:4602000000000000;0c:0000000000000000;0d:0000000000000000;0e:2800000000000000;0f:2026600001000000;10:c67f1a88ff7f0000;11:4602000000000000;12:0700000000000000;13:0000000000000000;14:0000000000000000;#00
<  25> send packet: $qThreadStopInfo3fe2a3#bf
< 542> read packet: $T00thread:3fe2a3;qaddr:100687180;threads:3fe26e,3fe292,3fe293,3fe294,3fe2a3,3fe2b4,3fe2c3,3fe2d2,3fe2f3,3fe56a,3fe56d;00:7001000200000000;01:0000000000000000;02:186f680001000000;03:0000000000000000;04:0400000000000000;05:0000000000000000;06:506f680001000000;07:186f680001000000;08:ff1000a000000000;09:0000000000000000;0a:0000000000000000;0b:4602000000000000;0c:ff08000000000000;0d:0717000000000000;0e:0070680001000000;0f:1500000000000000;10:46891a88ff7f0000;11:4602000000000000;12:0700000000000000;13:0000000000000000;14:0000000000000000;#00
<  25> send packet: $qThreadStopInfo3fe2b4#c1
< 542> read packet: $T00thread:3fe2b4;qaddr:1056f5180;threads:3fe26e,3fe292,3fe293,3fe294,3fe2a3,3fe2b4,3fe2c3,3fe2d2,3fe2f3,3fe56a,3fe56d;00:7001000200000000;01:0000010000000000;02:184f6f0501000000;03:0000000000000000;04:0400000000000000;05:0000000000000000;06:504f6f0501000000;07:184f6f0501000000;08:0200000000000000;09:0000200001000000;0a:0000000000000000;0b:4602000000000000;0c:ff08008000000000;0d:1333000000000000;0e:00506f0501000000;0f:1500000000000000;10:46891a88ff7f0000;11:4602000000000000;12:0700000000000000;13:0000000000000000;14:0000000000000000;#00
<  25> send packet: $qThreadStopInfo3fe2c3#c1
< 542> read packet: $T00thread:3fe2c3;qaddr:107e81180;threads:3fe26e,3fe292,3fe293,3fe294,3fe2a3,3fe2b4,3fe2c3,3fe2d2,3fe2f3,3fe56a,3fe56d;00:7001000200000000;01:0000010000000000;02:180fe80701000000;03:0000000000000000;04:0400000000000000;05:0000000000000000;06:500fe80701000000;07:180fe80701000000;08:de182f88ff7f0000;09:0000300001000000;0a:0000000000000000;0b:4602000000000000;0c:ff20008000000000;0d:0b72000000000000;0e:0010e80701000000;0f:2100000000000000;10:46891a88ff7f0000;11:4602000000000000;12:0700000000000000;13:0000000000000000;14:0000000000000000;#00
<  25> send packet: $qThreadStopInfo3fe2d2#c1
< 542> read packet: $T00thread:3fe2d2;qaddr:109e81180;threads:3fe26e,3fe292,3fe293,3fe294,3fe2a3,3fe2b4,3fe2c3,3fe2d2,3fe2f3,3fe56a,3fe56d;00:7001000200000000;01:0000010000000000;02:180fe80901000000;03:0000000000000000;04:0400000000000000;05:0000000000000000;06:500fe80901000000;07:180fe80901000000;08:0100000000000000;09:0000000000000000;0a:0000000000000000;0b:4602000000000000;0c:ff08008000000000;0d:1b50000000000000;0e:0010e80901000000;0f:1500000000000000;10:46891a88ff7f0000;11:4602000000000000;12:0700000000000000;13:0000000000000000;14:0000000000000000;#00
<  25> send packet: $qThreadStopInfo3fe2f3#c4
< 542> read packet: $T00thread:3fe2f3;qaddr:109f84180;threads:3fe26e,3fe292,3fe293,3fe294,3fe2a3,3fe2b4,3fe2c3,3fe2d2,3fe2f3,3fe56a,3fe56d;00:7001000200000000;01:0000000000000000;02:183ff80901000000;03:0000000000000000;04:0400000000000000;05:0000000000000000;06:503ff80901000000;07:183ff80901000000;08:ff1000a000000000;09:0000000000000000;0a:0000000000000000;0b:4602000000000000;0c:ff08000000000000;0d:0380000000000000;0e:0040f80901000000;0f:1500000000000000;10:46891a88ff7f0000;11:4602000000000000;12:0700000000000000;13:0000000000000000;14:0000000000000000;#00
<  25> send packet: $qThreadStopInfo3fe56a#c5
< 542> read packet: $T00thread:3fe56a;qaddr:10a703180;threads:3fe26e,3fe292,3fe293,3fe294,3fe2a3,3fe2b4,3fe2c3,3fe2d2,3fe2f3,3fe56a,3fe56d;00:7001000200000000;01:0000000000000000;02:182f700a01000000;03:0000000000000000;04:0400000000000000;05:0000000000000000;06:502f700a01000000;07:182f700a01000000;08:1b00000000000000;09:0000400001000000;0a:0000000000000000;0b:4602000000000000;0c:ff08000000000000;0d:2f97000000000000;0e:0030700a01000000;0f:1500000000000000;10:46891a88ff7f0000;11:4602000000000000;12:0700000000000000;13:0000000000000000;14:0000000000000000;#00
<  25> send packet: $qThreadStopInfo3fe56d#c8
< 542> read packet: $T00thread:3fe56d;qaddr:10a7a3180;threads:3fe26e,3fe292,3fe293,3fe294,3fe2a3,3fe2b4,3fe2c3,3fe2d2,3fe2f3,3fe56a,3fe56d;00:1f00000100000000;01:ffffffff00000000;02:481f7a0a01000000;03:0000000000000000;04:b0207a0a01000000;05:0608000700000000;06:901f7a0a01000000;07:481f7a0a01000000;08:039d000000000000;09:ffffffff00000000;0a:000c000000000000;0b:0602000000000000;0c:000c000000000000;0d:0000000000000000;0e:b0207a0a01000000;0f:039d000000000000;10:2e351a88ff7f0000;11:0602000000000000;12:0700000000000000;13:0000000000000000;14:0000000000000000;#00


Above you will see "XX:YYYYYYYYYYYY" where XX are two hex digits for the register number followed by a : and the register bytes. Note these register bytes are in native endian format, not big endian.



> On Jan 20, 2015, at 2:02 PM, Ted Woodward <ted.woodward at codeaurora.org> wrote:
> 
> "The initial stop packet gives us enough registers to know what the current
> stack frame is."
> 
> Which registers would you suggest I have my simulator return in the stop
> packet?
> 
> --
> Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
> Linux Foundation Collaborative Project
> 
> -----Original Message-----
> From: lldb-dev-bounces at cs.uiuc.edu [mailto:lldb-dev-bounces at cs.uiuc.edu] On
> Behalf Of Jason Molenda
> Sent: Tuesday, January 20, 2015 3:16 PM
> To: Jim Ingham
> Cc: lldb-dev at cs.uiuc.edu
> Subject: Re: [lldb-dev] Problem unwinding from inside of a CRT function
> 
> 
>> On Jan 20, 2015, at 1:06 PM, jingham at apple.com wrote:
>> 
>> 
>>> On Jan 20, 2015, at 12:31 PM, Zachary Turner <zturner at google.com> wrote:
>>> 
>>> In practice how slow is this for stepping over very lengthy calls?  It
> sounds like LLDB still generates a call stack at every branch point, which
> while certainly faster than generating one at every instruction, still seems
> like it has the potential to be very slow.  
>> 
>> At most, lldb only needs to get the current frame & its parent frame to
> run its stepping algorithm.  It won't generate a full stack frame unless you
> ask it to.  Getting two frames should be pretty quick.
> 
> Specifically -- it will take three packets.  The initial stop packet gives
> us enough registers to know what the current stack frame is.  lldb will make
> one memory read of the stack memory, which gives it enough to reconstruct
> the caller stack frame.  T packet, memory read, memory read result.  Then
> lldb knows whether to continue stepping, set a breakpoint & resume, or stop
> stepping.
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
> 
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev





More information about the lldb-dev mailing list