behavior of 'step' command in scripts execution

"dgutson ." <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAFdMc-1b=Z9U_s1Kag_Qc9+GNqtCyTS6Knvx_-H4YhV_21NzmQ@mail.gmail.com>
Why a step command stops the execution of a breakpoint's commands?

For example, consider these files:

//file.cpp:
#include <iostream>
using namespace std;

int f(int x)
{
    x++;          // this is line 6
    return x;
}

int main()
{
    cout << f(3);
}

// file.gdb
br file.cpp:6
comm
silent
step
set x=5
cont
end

When I run gdb with the binary and the script, execution stops in the
"return x" line (line 7), getting gdb's prompt and x is not modified.
If I enter "continue", "4" is shown.
I observe this behavior since many versions ago (don't recall since
when, and I don't know if it has ever been in another way). I compiled
the example with -ggdb3 option.

What I would expect is that the breakpoint's commands execute all, and
get "5" as output.

If there is agreement, I'd like to write a patch to fix this behavior
through a setting, something like
    set set-behavior continue
or alike, so it won't break compatibility.

Thanks,
   Daniel.


-- 
Who’s got the sweetest disposition?
One guess, that’s who?
Who’d never, ever start an argument?
Who never shows a bit of temperament?
Who's never wrong but always right?
Who'd never dream of starting a fight?
Who get stuck with all the bad luck?
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.