You are probably not placing the commands on the breakpoint you think you are.
If I were you, I'd modify the script to the following:
define setup
handle SIGTRAP noprint nostop
br 'Class1::Fun1(void)'
run
br 'Class2::Run(void)'
c
br Function2
commands
return 0
c
end
end
If no breakpoint target is given, commands
associates with the most recent breakpoint. This way, no matter what other breakpoints you have in your gdb session, your commands will be associated with the breakpoint at Function2.
alesplin
2010-02-24 18:44:35