This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix behaviour of 'show' commands in hook functions in MI mode


Thomas,

I apologize for the late review. And thank you for pinging us.

> This is my first patch, so apologies in advance for anything that I
> haven't done quite right.

Quite good, actually, for a first patch :-).

> In console mode, if I add a 'hook-run' which executes (for example)
> 'show inferior-tty', the result is printed before the run, and if I
> add a 'hookpost-run' with the same command, the result is printed
> after the run.  This behaviour matches the documentation (and my
> expectations).
> 
> In MI mode, 'show' commands in post-execution hooks seem to be
> ignored, and the result of a 'show' in a pre-execution hook is
> printed AFTER the hooked command has terminated, for example in an
> exec-async-output record as follows:
> 
> *stopped,value="<result of show command>",reason="exited-normally"
> 
> The following patch modifies the behaviour of a 'show' command
> executed in a hook function in MI mode, so that it will print the
> result using the console-mode behaviour, wrapped up as an MI
> console-stream-output record.
> 
> I hope this is reasonable -- please get in touch if it warrants discussion.
> 
> To reproduce:
> 
> echo "int main() { }" | gcc -x c -
> echo -e "set inferior-tty /dev/null\ndefine hook-run\nshow \
> inferior-tty\nend\nrun\nquit" > x
> gdb -i=mi -x x ./a.out
> 
> Patch:

Replace the above by the name of the ChangeLog you're changing. Eg:

| gdb/ChangeLog:

> 
>        * cli/cli-setshow.c: Print the results of 'show' commands in hook
>        functions in MI mode using the console-mode behaviour.

The patch looks reasonable to me.

Can you create a testcase for this? I don't have much experience with
writing GDB/MI testcases, but that should be fairly straightforward
to do, and we'll need that in order to avoid regressing.

Also, have you exercised your patch against the testsuite? If you did,
then it is important to explicitly say so and include the platform on
which it was done.

-- 
Joel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]