[haiku-bugs] [Haiku] #10459: [Debugger] Investigate anomalous single stepping behavior

  • From: "anevilyak" <trac@xxxxxxxxxxxx>
  • Date: Thu, 23 Jan 2014 02:42:00 -0000

#10459: [Debugger] Investigate anomalous single stepping behavior
-----------------------------------+------------------------------
 Reporter:  anevilyak              |        Owner:  anevilyak
     Type:  bug                    |       Status:  new
 Priority:  normal                 |    Milestone:  R1
Component:  Applications/Debugger  |      Version:  R1/Development
 Keywords:                         |   Blocked By:
 Blocking:                         |  Has a Patch:  0
 Platform:  All                    |
-----------------------------------+------------------------------
 In certain instances, some unusual single stepping behavior can be
 observed, as seen in the attached example program. If one steps through
 the program until hitting line 19, the next single step would be expected
 to jump to either the closing scope line of the current block (line 22),
 or the closing line of the function (line 25).

 With gcc2, the latter is observed as expected. With gcc4 however, the next
 step unexpectedly takes us to line 21 instead. There are some differences
 in the generated line number programs between the two compilers, but at
 least a cursory glance through our state machine implementation doesn't
 reveal any obvious problems in handling the involved opcodes. It should
 further be noted that this behavior is only observed when the locally
 scoped object is declared at line 15 ; without it, behavior similar to
 gcc2 is observed.

 Needs further investigation, and probably some additional tracing output
 to allow us to better compare our state machine execution with the
 corresponding output of objdump for the line number program in question.
 One possible candidate that gcc4 emits that gcc2 does not is the
 discriminator, but the DWARF specification is quite vague on how to
 actually make use of that apart from simply parsing the corresponding
 instruction/value.

 Objdump output for gcc2:
 {{{
 Raw dump of debug contents of section .debug_line:

   Offset:                      0x0
   Length:                      252
   DWARF Version:               2
   Prologue Length:             46
   Minimum Instruction Length:  4
   Initial value of 'is_stmt':  1
   Line Base:                   -10
   Line Range:                  245
   Opcode Base:                 10

  Opcodes:
   Opcode 1 has 0 args
   Opcode 2 has 1 args
   Opcode 3 has 1 args
   Opcode 4 has 1 args
   Opcode 5 has 1 args
   Opcode 6 has 0 args
   Opcode 7 has 0 args
   Opcode 8 has 0 args
   Opcode 9 has 1 args

  The Directory Table is empty.

  The File Name Table:
   Entry Dir     Time    Size    Name
   1     0       0       0       steptest.cpp
   2     0       0       0       <internal>

  Line Number Statements:
   Extended opcode 2: set Address to 0xa30
   Special opcode 20: advance Address by 0 to 0xa30 and Line by 10 to 11
   Extended opcode 2: set Address to 0xa43
   Special opcode 11: advance Address by 0 to 0xa43 and Line by 1 to 12
   Extended opcode 2: set Address to 0xa4a
   Special opcode 11: advance Address by 0 to 0xa4a and Line by 1 to 13
   Extended opcode 2: set Address to 0xa4a
   Special opcode 11: advance Address by 0 to 0xa4a and Line by 1 to 14
   Extended opcode 2: set Address to 0xa4a
   Special opcode 11: advance Address by 0 to 0xa4a and Line by 1 to 15
   Extended opcode 2: set Address to 0xa59
   Special opcode 11: advance Address by 0 to 0xa59 and Line by 1 to 16
   Extended opcode 2: set Address to 0xa5f
   Special opcode 11: advance Address by 0 to 0xa5f and Line by 1 to 17
   Extended opcode 2: set Address to 0xa80
   Special opcode 11: advance Address by 0 to 0xa80 and Line by 1 to 18
   Extended opcode 2: set Address to 0xa89
   Special opcode 11: advance Address by 0 to 0xa89 and Line by 1 to 19
   Extended opcode 2: set Address to 0xaa6
   Special opcode 11: advance Address by 0 to 0xaa6 and Line by 1 to 20
   Extended opcode 2: set Address to 0xaaf
   Special opcode 11: advance Address by 0 to 0xaaf and Line by 1 to 21
   Extended opcode 2: set Address to 0xae8
   Special opcode 13: advance Address by 0 to 0xae8 and Line by 3 to 24
   Extended opcode 2: set Address to 0xb63
   Special opcode 11: advance Address by 0 to 0xb63 and Line by 1 to 25
   Extended opcode 2: set Address to 0xb6c
   Special opcode 14: advance Address by 0 to 0xb6c and Line by 4 to 29
   Extended opcode 2: set Address to 0xb7f
   Special opcode 11: advance Address by 0 to 0xb7f and Line by 1 to 30
   Extended opcode 2: set Address to 0xb84
   Special opcode 12: advance Address by 0 to 0xb84 and Line by 2 to 32
   Extended opcode 2: set Address to 0xb8c
   Special opcode 11: advance Address by 0 to 0xb8c and Line by 1 to 33
   Extended opcode 2: set Address to 0xb97
   Extended opcode 1: End of Sequence

   Extended opcode 2: set Address to 0xb98
   Special opcode 12: advance Address by 0 to 0xb98 and Line by 2 to 3
   Extended opcode 2: set Address to 0xbc7
   Extended opcode 1: End of Sequence

   Extended opcode 2: set Address to 0xbd0
   Special opcode 13: advance Address by 0 to 0xbd0 and Line by 3 to 4
   Extended opcode 2: set Address to 0xc1d
   Extended opcode 1: End of Sequence

   Extended opcode 2: set Address to 0xc20
   Special opcode 42: advance Address by 0 to 0xc20 and Line by 32 to 33
   Extended opcode 2: set Address to 0xc6c
   Extended opcode 1: End of Sequence
 }}}

 Objdump output for gcc4:
 {{{
 Raw dump of debug contents of section .debug_line:

   Offset:                      0x0
   Length:                      127
   DWARF Version:               2
   Prologue Length:             35
   Minimum Instruction Length:  1
   Initial value of 'is_stmt':  1
   Line Base:                   -5
   Line Range:                  14
   Opcode Base:                 13

  Opcodes:
   Opcode 1 has 0 args
   Opcode 2 has 1 args
   Opcode 3 has 1 args
   Opcode 4 has 1 args
   Opcode 5 has 1 args
   Opcode 6 has 0 args
   Opcode 7 has 0 args
   Opcode 8 has 0 args
   Opcode 9 has 1 args
   Opcode 10 has 0 args
   Opcode 11 has 0 args
   Opcode 12 has 1 args

  The Directory Table is empty.

  The File Name Table:
   Entry Dir     Time    Size    Name
   1     0       0       0       steptest.cpp

  Line Number Statements:
   Extended opcode 2: set Address to 0x952
   Special opcode 7: advance Address by 0 to 0x952 and Line by 2 to 3
   Special opcode 201: advance Address by 14 to 0x960 and Line by 0 to 3
   Advance PC by 26 to 0x97a
   Extended opcode 1: End of Sequence

   Extended opcode 2: set Address to 0x97a
   Special opcode 8: advance Address by 0 to 0x97a and Line by 3 to 4
   Advance PC by constant 17 to 0x98b
   Special opcode 19: advance Address by 1 to 0x98c and Line by 0 to 4
   Extended opcode 4: set Discriminator to 1
   Set is_stmt to 0
   Advance PC by 36 to 0x9b0
   Special opcode 5: advance Address by 0 to 0x9b0 and Line by 0 to 4
   Special opcode 201: advance Address by 14 to 0x9be and Line by 0 to 4
   Advance PC by 5 to 0x9c3
   Extended opcode 1: End of Sequence

   Extended opcode 2: set Address to 0x9c4
   Special opcode 8: advance Address by 0 to 0x9c4 and Line by 3 to 4
   Advance PC by constant 17 to 0x9d5
   Special opcode 19: advance Address by 1 to 0x9d6 and Line by 0 to 4
   Advance PC by 33 to 0x9f7
   Extended opcode 1: End of Sequence

   Extended opcode 2: set Address to 0x898
   Advance Line by 10 to 11
   Copy
   Advance PC by constant 17 to 0x8a9
   Special opcode 48: advance Address by 3 to 0x8ac and Line by 1 to 12
   Special opcode 106: advance Address by 7 to 0x8b3 and Line by 3 to 15
   Special opcode 216: advance Address by 15 to 0x8c2 and Line by 1 to 16
   Special opcode 90: advance Address by 6 to 0x8c8 and Line by 1 to 17
   Special opcode 174: advance Address by 12 to 0x8d4 and Line by 1 to 18
   Special opcode 132: advance Address by 9 to 0x8dd and Line by 1 to 19
   Special opcode 174: advance Address by 12 to 0x8e9 and Line by 1 to 20
   Special opcode 132: advance Address by 9 to 0x8f2 and Line by 1 to 21
   Advance PC by 37 to 0x917
   Special opcode 8: advance Address by 0 to 0x917 and Line by 3 to 24
   Special opcode 104: advance Address by 7 to 0x91e and Line by 1 to 25
   Special opcode 121: advance Address by 8 to 0x926 and Line by 4 to 29
   Advance PC by constant 17 to 0x937
   Special opcode 132: advance Address by 9 to 0x940 and Line by 1 to 30
   Special opcode 77: advance Address by 5 to 0x945 and Line by 2 to 32
   Special opcode 76: advance Address by 5 to 0x94a and Line by 1 to 33
   Advance PC by 7 to 0x951
   Extended opcode 1: End of Sequence

 }}}

--
Ticket URL: <https://dev.haiku-os.org/ticket/10459>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: