consistent views at recommended breakpoints alexandre
play

Consistent Views at Recommended Breakpoints Alexandre Oliva - PowerPoint PPT Presentation

1 Consistent Views at Recommended Breakpoints Alexandre Oliva aoliva@redhat.com http://identi.ca/lxoliva/ http://people.redhat.com/~aoliva/ GCC Summit, October, 2010 Consistent Views at Recommended Breakpoints Alexandre Oliva 2 Summary


  1. 1 Consistent Views at Recommended Breakpoints Alexandre Oliva aoliva@redhat.com http://identi.ca/lxoliva/ http://people.redhat.com/~aoliva/ GCC Summit, October, 2010

  2. Consistent Views at Recommended Breakpoints Alexandre Oliva 2 Summary • Motivation • Background – Line numbers – Variable locations • Consistent views • Statement frontiers • DWARF extensions

  3. Consistent Views at Recommended Breakpoints Alexandre Oliva 3 Motivation • Set breakpoint at a line... – Stop at a later line, results clobbered – Computation of previous lines not complete – Stepping bounces back and forth • Recommended inspection points

  4. Consistent Views at Recommended Breakpoints Alexandre Oliva 4 Sample Program C RISC asm 1 int f(a, b, c, d) { f: r2(a) ← *(sp+ 4) 2 int x = a + b; r3(b) ← *(sp+ 8) r4(x) ← r2(a) + r3(b) r5(c) ← *(sp+12) ⇒ 3 int y = c / d; r6(d) ← *(sp+16) r7(y) ← r5(c) / r6(d) 4 x -= y; 5 return x; r1(x) ← r4(x) - r7(y) 6 } ret

  5. Consistent Views at Recommended Breakpoints Alexandre Oliva 5 Optimization Before sched After sched 3 r5(c) ← *(sp+12) 3 r6(d) ← *(sp+16) r2(a) ← *(sp+ 4) 2 2 r2(a) ← *(sp+ 4) r3(b) ← *(sp+ 8) 2 2 r3(b) ← *(sp+ 8) 3 r7(y) ← r5(c) / r6(d) ⇒ r4(x) ← r2(a) + r3(b) 2 2 r4(x) ← r2(a) + r3(b) r5(c) ← *(sp+12) 3 r6(d) ← *(sp+16) 3 r7(y) ← r5(c) / r6(d) 3 r1(x) ← r4(x) - r7(y) 5 5 r1(x) ← r4(x) - r7(y) ret 5 5 ret

  6. Consistent Views at Recommended Breakpoints Alexandre Oliva 6 Line Numbers PC loc: F L is stmt S PC = &f - .text PC L S .loc 1 3 is stmt 1 PC += 0, L += 3 0 3 1 0 r5(c) ← *(sp+12) . 0 4 r6(d) ← *(sp+16) . 3 0 .loc 1 2 is stmt 1 PC += 8, L += -1 8 2 1 8 r2(a) ← *(sp+ 4) 12 r3(b) ← *(sp+ 8) ⇒ ≡ .loc 1 3 is stmt 1 PC += 8, L += 1 16 3 1 16 r7(y) ← r5(c) / r6(d) .loc 1 2 is stmt 1 PC += 4, L += -1 20 2 1 20 r4(x) ← r2(a) + r3(b) .loc 1 5 is stmt 1 PC += 4, L += 3 24 5 1 24 r1(x) ← r4(x) - r7(y) 28 ret

  7. Consistent Views at Recommended Breakpoints Alexandre Oliva 7 Variable Location Lists .loc 1 3 is stmt 1 : ≤ PC < Len+Expr 0 r5(c) ← *(sp+12) a 0 32 2 breg 0 4 4 r6(d) ← *(sp+16) 12 32 1 reg2 .loc 1 2 is stmt 1 0 0 8 r2( a ) ← *( sp + 4 ) b 0 32 2 breg0 8 12 r3(b) ← *(sp+ 8 ) 16 32 1 reg3 .loc 1 3 is stmt 1 ⇒ 0 0 16 r 7 (y) ← r5(c) / r6(d) y 20 32 1 reg 7 .loc 1 2 is stmt 1 0 0 20 r4(x) ← r2(a) + r3(b) x 24 28 1 reg4 .loc 1 5 is stmt 1 28 32 1 reg1 24 r1(x) ← r4(x) - r7(y) 0 0 28 ret

  8. Consistent Views at Recommended Breakpoints Alexandre Oliva 8 Variable Tracking at Assignments # a ⇒ *(sp+ 4) 1 f(a,b,c,d) { ... .loc 1 2 is stmt 1 1 # a ⇒ a 8 r2(a) ← *(sp+ 4) 1 # b ⇒ b 12 r3(b) ← *(sp+ 8) 1 # c ⇒ c .loc 1 3 is stmt 1 1 # d ⇒ d 16 r7(y) ← r5(c) / r6(d) 2 int x = a + b; .loc 1 2 is stmt 1 2 # x ⇒ x ⇒ 20 r4(x) ← r2(a) + r3(b) 3 int y = c / d; # x ⇒ r4 (x) 3 # y ⇒ y # y ⇒ r7(y) 4 x -= y; # x ⇒ r4(x) - r7(y) 4 # x ⇒ x .loc 1 5 is stmt 1 5 return x; 24 r1(x) ← r4(x) - r7(y) 6 } 28 ret

  9. Consistent Views at Recommended Breakpoints Alexandre Oliva 9 Variable Tracking at Assignments # a ⇒ *(sp+ 4) 0 32 2 breg0 4 a ... .loc 1 2 is stmt 1 12 32 1 reg2 8 r2(a) ← *(sp+ 4) 0 0 12 r3(b) ← *(sp+ 8) .loc 1 3 is stmt 1 24 32 1 reg 7 y 16 r7(y) ← r5(c) / r6(d) 0 0 .loc 1 2 is stmt 1 24 24 1 reg4 x ⇒ 20 r4(x) ← r2(a) + r3(b) 24 32 6 breg4 0 # x ⇒ r4(x) breg7 0 # y ⇒ r7 (y) minus # x ⇒ r4(x) - r7(y) stack value .loc 1 5 is stmt 1 28 32 1 reg 1 24 r1 (x) ← r4(x) - r7(y) 0 0 28 ret

  10. Consistent Views at Recommended Breakpoints Alexandre Oliva 10 Consistent Views .loc 1 2 is stmt 0 .loc 1 2 is stmt 1 8 r2(a) ← *(sp+ 4) 8 r2(a) ← *(sp+ 4) ... .loc 1 3 is stmt 0 ... .loc 1 3 is stmt 1 16 r7(y) ← r5(c) / r6(d) 16 r7(y) ← r5(c) / r6(d) .loc 1 2 is stmt 1 .loc 1 2 is stmt 1 20 r4(x) ← r2(a) + r3(b) 20 r4(x) ← r2(a) + r3(b) # x ⇒ r4(x) # x ⇒ r4(x) ⇒ .loc 1 3 is stmt 1 # y ⇒ r7(y) # y ⇒ r7(y) .loc 1 4 is stmt 1 # x ⇒ r4(x) - r7(y) # x ⇒ r4(x) - r7(y) .loc 1 5 is stmt 1 .loc 1 5 is stmt 1 24 r1(x) ← r4(x) - r7(y) 24 r1(x) ← r4(x) - r7(y)

  11. Consistent Views at Recommended Breakpoints Alexandre Oliva 11 Statement Frontiers 1 int f(a, b, c, d) { 1 int f(a, b, c, d) { 2 # BOS 2 int x = a + b; 2 int x = a + b; 2 # x ⇒ x 2 # x ⇒ x 3 # BOS 3 int y = c / d; 3 int y = c / d; 3 # y ⇒ y 3 # y ⇒ y ⇒ 4 # BOS 4 x -= y; 4 x -= y; 4 # x ⇒ x 4 # x ⇒ x 5 # BOS 5 return x; 5 return x; 6 } 6 }

  12. Consistent Views at Recommended Breakpoints Alexandre Oliva 12 DWARF v4 Encoding PC L S 0 32 2 breg0 4 a ... .loc 1 2 is stmt 0 8 2 0 12 32 1 reg2 8 r2(a) ← *(sp+ 4) 0 0 ... .loc 1 3 is stmt 0 16 3 0 16 r7(y) ← r5(c) / r6(d) 24 32 1 reg7 y .loc 1 2 is stmt 1 20 2 1 0 0 20 r4(x) ← r2(a) + r3(b) 24 24 1 reg4 x + ⇒ # x ⇒ r4(x) 24 32 6 breg4 0 .loc 1 3 is stmt 1 24 3 1 breg7 0 # y ⇒ r7(y) minus .loc 1 4 is stmt 1 24 4 1 stack value # x ⇒ r4(x) - r7(y) 28 32 1 reg1 .loc 1 5 is stmt 1 24 5 1 0 0 24 r1(x) ← r4(x) - r7(y)

  13. Consistent Views at Recommended Breakpoints Alexandre Oliva 13 DWARF Extensions • Discriminating same-PC labels • Compact, compatible, asm .loc-able • Column in line-number table: discriminator? • New opcodes in location expressions? • New fields in location lists? • New attribute for variables?

  14. Consistent Views at Recommended Breakpoints Alexandre Oliva 14 DWARF v4+ Encoding PC .V L S variable y ... .loc 1 2 is stmt 0 8 .0 2 0 location has views 8 r2(a) ← *(sp+ 4) variable x ... .loc 1 3 is stmt 0 16 .0 3 0 location has views 16 r7(y) ← r5(c) / r6(d) 24 32 1 reg7 y .loc 1 2 is stmt 1 20 .0 2 1 0 0 . 1 0 20 r4(x) ← r2(a) + r3(b) ⇒ 24 24 1 reg4 x # x ⇒ r4(x) 24 32 6 breg4 0 .loc 1 3 is stmt 1 24 .0 3 1 breg7 0 # y ⇒ r7(y) minus .loc 1 4 is stmt 1 24 .1 4 1 stack value # x ⇒ r4(x) - r7(y) 28 32 1 reg1 .loc 1 5 is stmt 1 24 .2 5 1 0 0 . 0 2 2 0 0 0 24 r1(x) ← r4(x) - r7(y)

  15. Consistent Views at Recommended Breakpoints Alexandre Oliva 15 Final remarks • Assembler-assigned .view numbers • “Works” with old debug info consumers • Advance views at same PC (J. Kratochvil) • View per line, stmt, side-effect: “-gO0d” • Supports reordering, not restructuring • Implementation underway Thank you!

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend