child.logfile_send = f_send
child.logfile_read = f_read
- child.send("-file-exec-and-symbols " + self.myexe)
- child.sendline('')
+ child.sendline("-file-exec-and-symbols " + self.myexe)
child.expect("\^done")
- child.send("-break-insert -f a_MyFunction")
- child.sendline('')
+ child.sendline("-break-insert -f a_MyFunction")
child.expect("\^done,bkpt={number=\"1\"")
- child.send("-exec-run")
- child.sendline('') # FIXME: lldb-mi hangs here, so the extra return below is needed
- child.send("")
- child.sendline('')
+ child.sendline("-exec-run")
+ child.sendline("") # FIXME: lldb-mi hangs here, so extra return is needed
child.expect("\^running")
child.expect("\*stopped,reason=\"breakpoint-hit\"")
- child.send("-exec-continue")
- child.sendline('')
+ child.sendline("-exec-continue")
child.expect("\^running")
child.expect("\*stopped,reason=\"exited-normally\"")
child.expect_exact(prompt)
- child.send("quit")
- child.sendline('')
+ child.sendline("quit")
# Now that the necessary logging is done, restore logfile to None to
# stop further logging.
child.logfile_send = f_send
child.logfile_read = f_read
- child.send("-file-exec-and-symbols " + self.myexe)
- child.sendline('')
+ child.sendline("-file-exec-and-symbols " + self.myexe)
child.expect("\^done")
- child.send("-break-insert -f main.c:22")
- child.sendline('')
+ # Find the line number to break inside main() and set
+ # pending BP.
+ self.line = line_number('main.c', '//BP_source')
+ child.sendline("-break-insert -f main.c:%d" % self.line)
child.expect("\^done,bkpt={number=\"1\"")
- child.send("-exec-run")
- child.sendline('') # FIXME: lldb-mi hangs here, so the extra return below is needed
- child.send("")
- child.sendline('')
+ child.sendline("-exec-run")
+ child.sendline("") # FIXME: lldb-mi hangs here, so extra return is needed
child.expect("\^running")
child.expect("\*stopped,reason=\"breakpoint-hit\"")
- child.send("-exec-continue")
- child.sendline('')
+ child.sendline("-exec-continue")
child.expect("\^running")
child.expect("\*stopped,reason=\"exited-normally\"")
child.expect_exact(prompt)
- child.send("quit")
- child.sendline('')
+ child.sendline("quit")
# Now that the necessary logging is done, restore logfile to None to
# stop further logging.
child.logfile_send = f_send
child.logfile_read = f_read
- child.send("-file-exec-and-symbols " + self.myexe)
- child.sendline('')
+ child.sendline("-file-exec-and-symbols " + self.myexe)
child.expect("\^done")
- child.send("-break-insert -f main")
- child.sendline('')
+ child.sendline("-break-insert -f main")
child.expect("\^done,bkpt={number=\"1\"")
- child.send("-exec-run")
- child.sendline('') # FIXME: lldb-mi hangs here, so the extra return below is needed
- child.send("")
- child.sendline('')
+ child.sendline("-exec-run")
+ child.sendline("") # FIXME: lldb-mi hangs here, so extra return is needed
child.expect("\^running")
child.expect("\*stopped,reason=\"breakpoint-hit\"")
#break on symbol
- child.send("-break-insert a_MyFunction")
- child.sendline('')
+ child.sendline("-break-insert a_MyFunction")
child.expect("\^done,bkpt={number=\"2\"")
- child.send("-exec-continue")
- child.sendline('')
+ child.sendline("-exec-continue")
child.expect("\^running")
child.expect("\*stopped,reason=\"breakpoint-hit\"")
#break on source
- child.send("-break-insert main.c:29")
- child.sendline('')
+ self.line = line_number('main.c', '//BP_source')
+ child.sendline("-break-insert main.c:%d" % self.line)
child.expect("\^done,bkpt={number=\"3\"")
- child.send("-exec-continue")
- child.sendline('')
+ child.sendline("-exec-continue")
child.expect("\^running")
child.expect("\*stopped,reason=\"breakpoint-hit\"")
#run to exit
- child.send("-exec-continue")
- child.sendline('')
+ child.sendline("-exec-continue")
child.expect("\^running")
child.expect("\*stopped,reason=\"exited-normally\"")
child.expect_exact(prompt)
- child.send("quit")
- child.sendline('')
+ child.sendline("quit")
# Now that the necessary logging is done, restore logfile to None to
# stop further logging.
child.logfile_send = f_send
child.logfile_read = f_read
- child.send("-file-exec-and-symbols " + self.myexe)
- child.sendline('')
+ child.sendline("-file-exec-and-symbols " + self.myexe)
child.expect("\^done")
#run to main
- child.send("-break-insert -f main")
- child.sendline('')
+ child.sendline("-break-insert -f main")
child.expect("\^done,bkpt={number=\"1\"")
- child.send("-exec-run")
- child.sendline('') #FIXME: hangs here; extra return below is needed
- child.send("")
- child.sendline('')
+ child.sendline("-exec-run")
+ child.sendline("") #FIXME: hangs here; extra return is needed
child.expect("\^running")
child.expect("\*stopped,reason=\"breakpoint-hit\"")
- #run to program return
- child.send("-break-insert main.c:30") #BP_source
- child.sendline('')
+ #run to program return (marked BP_source)
+ self.line = line_number('main.c', '//BP_source')
+ child.sendline("-break-insert main.c:%d" % self.line)
child.expect("\^done,bkpt={number=\"2\"")
- child.send("-exec-continue")
- child.sendline('')
+ child.sendline("-exec-continue")
child.expect("\^running")
child.expect("\*stopped,reason=\"breakpoint-hit\"")
#print non-existant variable
- #child.send("-var-create var1 --thread 1 --frame 0 * undef")
- #child.sendline('') #FIXME: shows undef as {...}
+ #child.sendline("-var-create var1 --thread 1 --frame 0 * undef") #FIXME: shows undef as {...}
#child.expect("error")
- #child.send("-data-evaluate-expression undef")
- #child.sendline('') #FIXME: gets value="undef"
+ #child.sendline("-data-evaluate-expression undef") #FIXME: gets value="undef"
#child.expect("error")
#print global "g_MyVar"
- child.send("-var-create var1 --thread 1 --frame 0 * g_MyVar")
- child.sendline('') #FIXME: shows name=<unnamedvariable>"
+ child.sendline("-var-create var1 --thread 1 --frame 0 * g_MyVar") #FIXME: shows name=<unnamedvariable>"
child.expect("value=\"3\",type=\"int\"")
- #child.send("-var-evaluate-expression var1")
- #child.sendline('') #FIXME: gets var1 does not exist
- child.send("-var-show-attributes var1")
- child.sendline('')
+ #child.sendline("-var-evaluate-expression var1") #FIXME: gets var1 does not exist
+ child.sendline("-var-show-attributes var1")
child.expect("status=\"editable\"")
- child.send("-var-delete var1")
- child.sendline('')
+ child.sendline("-var-delete var1")
child.expect("\^done")
- child.send("-var-create var1 --thread 1 --frame 0 * g_MyVar")
- child.sendline('')
+ child.sendline("-var-create var1 --thread 1 --frame 0 * g_MyVar")
child.expect("value=\"3\",type=\"int\"")
#print static "s_MyVar" and modify
- child.send("-data-evaluate-expression s_MyVar")
- child.sendline('')
+ child.sendline("-data-evaluate-expression s_MyVar")
child.expect("value=\"30\"")
- child.send("-var-create var3 --thread 1 --frame 0 * \"s_MyVar=3\"")
- child.sendline('')
+ child.sendline("-var-create var3 --thread 1 --frame 0 * \"s_MyVar=3\"")
child.expect("value=\"3\",type=\"int\"")
- child.send("-data-evaluate-expression \"s_MyVar=30\"")
- child.sendline('')
+ child.sendline("-data-evaluate-expression \"s_MyVar=30\"")
child.expect("value=\"30\"")
#print local "b" and modify
- child.send("-data-evaluate-expression b")
- child.sendline('')
+ child.sendline("-data-evaluate-expression b")
child.expect("value=\"20\"")
- child.send("-var-create var3 --thread 1 --frame 0 * \"b=3\"")
- child.sendline('')
+ child.sendline("-var-create var3 --thread 1 --frame 0 * \"b=3\"")
child.expect("value=\"3\",type=\"int\"")
- child.send("-data-evaluate-expression \"b=20\"")
- child.sendline('')
+ child.sendline("-data-evaluate-expression \"b=20\"")
child.expect("value=\"20\"")
#print "a + b"
- child.send("-data-evaluate-expression \"a + b\"")
- child.sendline('')
+ child.sendline("-data-evaluate-expression \"a + b\"")
child.expect("value=\"30\"")
- child.send("-var-create var3 --thread 1 --frame 0 * \"a + b\"")
- child.sendline('')
+ child.sendline("-var-create var3 --thread 1 --frame 0 * \"a + b\"")
child.expect("value=\"30\",type=\"int\"")
#print "argv[0]"
- child.send("-data-evaluate-expression \"argv[0]\"")
- child.sendline('')
+ child.sendline("-data-evaluate-expression \"argv[0]\"")
child.expect("value=\"0x")
- child.send("-var-create var3 --thread 1 --frame 0 * \"argv[0]\"")
- child.sendline('')
+ child.sendline("-var-create var3 --thread 1 --frame 0 * \"argv[0]\"")
child.expect("numchild=\"1\",value=\"0x.*\",type=\"const char \*\"")
#run to exit
- child.send("-exec-continue")
- child.sendline('')
+ child.sendline("-exec-continue")
child.expect("\^running")
child.expect("\*stopped,reason=\"exited-normally\"")
child.expect_exact(prompt)
- child.send("quit")
- child.sendline('')
+ child.sendline("quit")
# Now that the necessary logging is done, restore logfile to None to
# stop further logging.
child.logfile_send = f_send
child.logfile_read = f_read
- child.send("-file-exec-and-symbols " + self.myexe)
- child.sendline('')
+ child.sendline("-file-exec-and-symbols " + self.myexe)
child.expect("\^done")
#run to main
- child.send("-break-insert -f main")
- child.sendline('')
+ child.sendline("-break-insert -f main")
child.expect("\^done,bkpt={number=\"1\"")
- child.send("-exec-run")
- child.sendline('') #FIXME: hangs here; extra return below is needed
- child.send("")
- child.sendline('')
+ child.sendline("-exec-run")
+ child.sendline("") #FIXME: hangs here; extra return is needed
child.expect("\^running")
child.expect("\*stopped,reason=\"breakpoint-hit\"")
#set doloop=1 and run (to loop forever)
- child.send("-data-evaluate-expression \"doloop=1\"")
- child.sendline('')
+ child.sendline("-data-evaluate-expression \"doloop=1\"")
child.expect("value=\"1\"")
- child.send("-exec-continue")
- child.sendline('')
+ child.sendline("-exec-continue")
child.expect("\^running")
- #issue interrupt, set a bp, and resume
- child.send("-exec-interrupt")
- child.sendline('')
+ #issue interrupt, set BP in loop (marked BP_loop), and resume
+ child.sendline("-exec-interrupt")
child.expect("\*stopped,reason=\"signal-received\"")
- child.send("-break-insert loop.c:11")
- child.sendline('')
+ self.line = line_number('loop.c', '//BP_loop')
+ child.sendline("-break-insert loop.c:%d" % self.line)
child.expect("\^done,bkpt={number=\"2\"")
- #child.send("-exec-resume")
- #child.sendline('') #FIXME: command not recognized
- child.send("-exec-continue")
- child.sendline('')
+ #child.sendline("-exec-resume") #FIXME: command not recognized
+ child.sendline("-exec-continue")
child.expect("\*stopped,reason=\"breakpoint-hit\"")
- #we should be sitting at loop.c:12
+ #we should have hit BP
#set loop=-1 so we'll exit the loop
- child.send("-data-evaluate-expression \"loop=-1\"")
- child.sendline('')
+ child.sendline("-data-evaluate-expression \"loop=-1\"")
child.expect("value=\"-1\"")
- child.send("-exec-continue")
- child.sendline('')
+ child.sendline("-exec-continue")
child.expect("\^running")
child.expect("\*stopped,reason=\"exited-normally\"")
child.expect_exact(prompt)
- child.send("quit")
- child.sendline('')
+ child.sendline("quit")
# Now that the necessary logging is done, restore logfile to None to
# stop further logging.
child.logfile_read = f_read
#use no path
- child.send("-file-exec-and-symbols " + self.myexe)
- child.sendline('')
+ child.sendline("-file-exec-and-symbols " + self.myexe)
child.expect("\^done")
- child.send("-exec-run")
- child.sendline('') # FIXME: lldb-mi hangs here, so the extra return below is needed
- child.send("")
- child.sendline('')
+ child.sendline("-exec-run")
+ child.sendline("") # FIXME: lldb-mi hangs here, so extra return is needed
child.expect("\^running")
child.expect("\*stopped,reason=\"exited-normally\"")
child.expect_exact(prompt)
- child.send("quit")
- child.sendline('')
+ child.sendline("quit")
# Now that the necessary logging is done, restore logfile to None to
# stop further logging.
#use full path
exe = os.path.join(os.getcwd(), "a.out")
- child.send("-file-exec-and-symbols " + exe)
- child.sendline('')
+ child.sendline("-file-exec-and-symbols " + exe)
child.expect("\^done")
- child.send("-exec-run")
- child.sendline('') # FIXME: lldb-mi hangs here, so the extra return below is needed
- child.send("")
- child.sendline('')
+ child.sendline("-exec-run")
+ child.sendline("") # FIXME: lldb-mi hangs here, so extra return is needed
child.expect("\^running")
child.expect("\*stopped,reason=\"exited-normally\"")
child.expect_exact(prompt)
- child.send("quit")
- child.sendline('')
+ child.sendline("quit")
# Now that the necessary logging is done, restore logfile to None to
# stop further logging.
#use relative path
exe = "../../" + self.mydir + "/" + self.myexe
- child.send("-file-exec-and-symbols " + exe)
- child.sendline('')
+ child.sendline("-file-exec-and-symbols " + exe)
child.expect("\^done")
- child.send("-exec-run")
- child.sendline('') # FIXME: lldb-mi hangs here, so the extra return below is needed
- child.send("")
- child.sendline('')
+ child.sendline("-exec-run")
+ child.sendline("") # FIXME: lldb-mi hangs here, so extra return is needed
child.expect("\^running")
child.expect("\*stopped,reason=\"exited-normally\"")
child.expect_exact(prompt)
- child.send("quit")
- child.sendline('')
+ child.sendline("quit")
# Now that the necessary logging is done, restore logfile to None to
# stop further logging.
print "\n\nContents of child_read.txt:"
print from_child
- @unittest2.skip("lldb-mi badpath hang")
@lldbmi_test
def test_lldbmi_badpathexe(self):
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols badpath/exe."""
child.logfile_send = f_send
child.logfile_read = f_read
- #use relative path
+ #use non-existant path
exe = "badpath/" + self.myexe
- #print ("-file-exec-and-symbols " + exe)
- child.send("-file-exec-and-symbols " + exe)
- child.sendline('') #FIXME: non-existant directory caused hang
+ child.sendline("-file-exec-and-symbols " + exe)
child.expect("\^error")
+ #child.expect_exact(prompt) #FIXME: no prompt after error
- child.expect_exact(prompt)
-
- child.send("quit")
- child.sendline('')
+ child.sendline("quit")
# Now that the necessary logging is done, restore logfile to None to
# stop further logging.
child.logfile_send = f_send
child.logfile_read = f_read
- child.send("-file-exec-and-symbols " + self.myexe)
- child.sendline('')
+ child.sendline("-file-exec-and-symbols " + self.myexe)
child.expect("\^done")
- #child.send("-exec-arguments l")
- #child.sendline('') #FIXME: not recognized and hung lldb-mi
- child.send("settings set target.run-args l")
- child.sendline('') #FIXME: args not passed
+ child.sendline("settings set target.run-args l") #FIXME: args not passed
+ #child.sendline("-exec-arguments l") #FIXME: not recognized and hung lldb-mi
#run to main
- child.send("-break-insert -f main")
- child.sendline('')
+ child.sendline("-break-insert -f main")
child.expect("\^done,bkpt={number=\"1\"")
- child.send("-exec-run")
- child.sendline('') #FIXME: hangs here; extra return below is needed
- child.send("")
- child.sendline('')
+ child.sendline("-exec-run")
+ child.sendline("") #FIXME: hangs here; extra return is needed
child.expect("\^running")
child.expect("\*stopped,reason=\"breakpoint-hit\"")
#check argc to see if arg passed
- child.send("-data-evaluate-expression argc")
- child.sendline('')
+ child.sendline("-data-evaluate-expression argc")
child.expect("value=\"2\"")
- #set BP on code which is only executed if "l" was passed correctly
- child.send("-break-insert main.c:27") #BP_argtest
- child.sendline('')
+ #set BP on code which is only executed if "l" was passed correctly (marked BP_argtest)
+ self.line = line_number('main.c', '//BP_argtest')
+ child.sendline("-break-insert main.c:%d" % self.line)
child.expect("\^done,bkpt={number=\"2\"")
- child.send("-exec-continue")
- child.sendline('')
+ child.sendline("-exec-continue")
child.expect("\^running")
child.expect("\*stopped,reason=\"breakpoint-hit\"")
- child.send("quit")
- child.sendline('')
+ child.sendline("quit")
# Now that the necessary logging is done, restore logfile to None to
# stop further logging.
sleep(1);
loop = 1;
}
- loop++; // Set break point at this line.
+ loop++; //BP_loop
}
return loop;
}