Avoid a failing test case by fixing things so the compiler generates a line table entry for line the very start of the printf() before any values have been loaded into registers.
Avoid a failing test case by fixing things so the compiler generates a line table entry for line the very start of the printf() before any values have been loaded into registers.

The issue was the previous code tried to stop on the following code in main.c:

21    // Stop here and set values
22    printf ("Val - %d Mine - %d, %d, %llu. Ptr - %d, %d, %llu\n", 
23            val, 
24            mine.first_val, mine.second_val, mine.third_val,
25            ptr->first_val, ptr->second_val, ptr->third_val); 

We we set a source regex breakpoint on "// Stop here and set values" we would set a breakpoint on line 22 as expected. 

The problem is the most recent clang compiler generates a line table like this


0x1000: main.c:23 // Loading of "val" into a register
0x1010: main.c:24 // Load mine.first_val, mine.second_val, mine.third_val values into registers or on the stack
0x1020: main.c:25 // Load ptr->first_val, ptr->second_val, ptr->third_val values into registers or on the stack
0x1030: main.c:22 // Call to printf

In this test, we run to line 22, then we use python to modify the value of "val" and then continue to another breakpoint and try to read the STDOUT from the printf to verify the values changed correctly.

With the above line table the value for "val" had already been loaded into a register so the string from printf would be incorrect.

Doing an easy fix for now by changing the code to:

21    // Stop here and set values
22  printf ("Val - %d Mine - %d, %d, %llu. Ptr - %d, %d, %llu\n", val, 
23          mine.first_val, mine.second_val, mine.third_val,
24          ptr->first_val, ptr->second_val, ptr->third_val); 


Now we get a line table entry for line 22 that is before any locals are read from the stack into registers.

I need to follow up with the compiler guys and see if we can get a fix for this as anyone setting file + line breeakpoints might be very surprised to have code from lines below the current line already have had their code run.



git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@232068 91177308-0d34-0410-b5e6-96231b3b80d8

llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb