RE: Question: gdb.tui/tui-layout-asm.exp

Carl Love via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
Andreas:

On Tue, 2021-07-20 at 10:01 +0200, Andreas Schwab wrote:
> On Jul 19 2021, Carl Love via Gdb wrote:
> 
> > So the if statement is checking to see if line1 matches the re_line
> > above it.  The match statement is 
> > 
> >    [regexp $re_line [Term::get_line 1]]
> > 
> > The final test fails for some reason?
> 
> Have you checked that [Term::get_line 1] really returns the same
> thing
> in both calls?

I had to rewrite the if statement a bit to be able to get to the result
of the get_line 1 read after the wait_for.  The code is now:

while (1) {                                                              
    # Grab the second line, this is about to become the first line.      
    puts " "                                                             
    set line [Term::get_line 2]                                          
    puts "Carll line $line"                

...

    if {[Term::wait_for $re_line]} {                                    
        puts "Carll  re_line $re_line"                                  
        set line1 [Term::get_line 1]                                    
        puts "Carll  line1 $line1"                                      
        if {[regexp $re_line $line1]} {                                 
            puts "Carll true"                                           
            # We scrolled successfully.                                 
        } else {                                                        
            puts "Carll match false"                                    
            fail "$testname (scroll failed)"                            
            Term::dump_screen                                           
            break                                                       
        }                                                               
    } else {                                                            
        puts "Carll wait for false"                                     
        fail "$testname (scroll failed)"                                
        Term::dump_screen                                               
        break                                                           
    }

The output is:

Carll line |    0x100007a8 <__glink_PLTresolve+48>      bctr                              |                             
CARLL, timeout, return 1                                                                                                
Carll  re_line \|\s+0x100007a8\s+<__glink_PLTresolve\+48>\s+bctr\s+\|                                                   
Carll  line1 |    0x100007a8 <__glink_PLTresolve+48>      bctr                              |                           
Carll true                                                                                                              
                                                                                                                        
Carll line |    0x100007ac <__libc_start_main@plt>      b       0x10000778 <__glink_PLTres|                             
CARLL, timeout, return 1                                                                                                
Carll  re_line \|\s+0x100007ac\s+<__libc_start_main@plt>\s+b\s+0x10000778\s+<__glink_PLTres\|                           
Carll  line1 |    0x100007ac <__libc_start_main@plt>      b       0x10000778 <__glink_PLTres|                           
Carll true                                                                                                              
                                                                                                                        
Carll line |    0x100007b0 <__gmon_start__@plt>         b       0x10000778 <__glink_PLTres|                             
CARLL, timeout, return 1                                                                                                
Carll  re_line \|\s+0x100007b0\s+<__gmon_start__@plt>\s+b\s+0x10000778\s+<__glink_PLTres\|                              
Carll  line1 |    0x100007b0 <__gmon_start__@plt> b       0x10000778 <__glink_PLTresolve>   |          <--  the read after the wait_for read more characters                 
Carll match false                                                                                                       
FAIL: gdb.tui/tui-layout-asm.exp: scroll to end of assembler (scroll failed)                                     


The initial read of line 2, which then becomes re_line has fewer
characters in it than when the same line is read the second time.  The
second read occurs following the wait_for statement. 

I played a little to try and put a wait_for in when doing the initial
"get_line 2".  That wait doesn't seem to work correctly.  I am looking
at the library routine to see if I am not use the wait_for call
correctly.  It is not clear yet why I get more characters the "second"
time the line is read.  I will keep digging but please let me know if
you have any thoughts on the issue.  Thanks.

                   Carl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.