public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* RE: MI usage inside a user-defined commands
@ 2005-07-06 14:02 Alain Magloire
  0 siblings, 0 replies; 13+ messages in thread
From: Alain Magloire @ 2005-07-06 14:02 UTC (permalink / raw)
  To: Karganov Konstantin, Daniel Jacobowitz; +Cc: gdb


> 
> 
> > The ability to use CLI syntax in MI mode is documented in the manual as
> > an unsupported, transitional feature.
> It is documented, that "MI accepts existing CLI commands" (section 24.4)
> and nothing is said about "unsupported" or "transitional" :)
> 
> > it's not to be used by frontends.
> That is clear, since the output format will be the mess of CLI and MI
> output.
> 


It is also practical, since not all MI Commands are implemented.
So if you want to do something with signals, the backend may not have a
Choice then to fallback to CLI.

Also note that mi2 has -interpreter-exec to allow the use of CLI.
The problem with that is the lost of synchronization state.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: MI usage inside a user-defined commands
  2005-07-07 14:16           ` Karganov Konstantin
@ 2005-07-07 21:47             ` Nick Roberts
  0 siblings, 0 replies; 13+ messages in thread
From: Nick Roberts @ 2005-07-07 21:47 UTC (permalink / raw)
  To: Karganov Konstantin; +Cc: Daniel Jacobowitz, gdb

 > > I don't know the intention - but usually, to manipulate program
 > > variables in MI, one uses varobj.
 > I know.
 > But it seems too much fuss to create a varobj, assign a value and delete 
 > it when I need just to raise a flag in a debugged program...

The implementation of -gdb-set currently does use CLI but it is still
presented as an MI command.  So, although the implementation might change, I
see no reason for the command itself to disappear.  Since the documentation
doesn't suggest it is temporary or should not be used for program variables, I
would use this command if it is more convenient.

Nick

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: MI usage inside a user-defined commands
  2005-07-07 13:03         ` Daniel Jacobowitz
@ 2005-07-07 14:16           ` Karganov Konstantin
  2005-07-07 21:47             ` Nick Roberts
  0 siblings, 1 reply; 13+ messages in thread
From: Karganov Konstantin @ 2005-07-07 14:16 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb


> I don't know the intention - but usually, to manipulate program
> variables in MI, one uses varobj.
I know.
But it seems too much fuss to create a varobj, assign a value and delete 
it when I need just to raise a flag in a debugged program...

Best regards,
Konstantin.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: MI usage inside a user-defined commands
  2005-07-07 12:21       ` Karganov Konstantin
@ 2005-07-07 13:03         ` Daniel Jacobowitz
  2005-07-07 14:16           ` Karganov Konstantin
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Jacobowitz @ 2005-07-07 13:03 UTC (permalink / raw)
  To: Karganov Konstantin; +Cc: gdb

On Thu, Jul 07, 2005 at 04:06:48PM +0400, Karganov Konstantin wrote:
> 
> > The ability to use CLI syntax in MI mode is documented in the manual as
> > an unsupported, transitional feature.
> By the way, the -gdb-set command is described as "Set an internal GDB 
> variable. The corresponding GDB command is set".
> From the description it is unclear - is "-gdb-set var" an ocasional 
> undocumented feature or the correct way of setting program variables.
> 
> I suggest it's better for the docs to state this explicitly.

I don't know the intention - but usually, to manipulate program
variables in MI, one uses varobj.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: MI usage inside a user-defined commands
  2005-07-06 13:50     ` Daniel Jacobowitz
  2005-07-06 13:57       ` Karganov Konstantin
@ 2005-07-07 12:21       ` Karganov Konstantin
  2005-07-07 13:03         ` Daniel Jacobowitz
  1 sibling, 1 reply; 13+ messages in thread
From: Karganov Konstantin @ 2005-07-07 12:21 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb


> The ability to use CLI syntax in MI mode is documented in the manual as
> an unsupported, transitional feature.
By the way, the -gdb-set command is described as "Set an internal GDB 
variable. The corresponding GDB command is set".
From the description it is unclear - is "-gdb-set var" an ocasional 
undocumented feature or the correct way of setting program variables.

I suggest it's better for the docs to state this explicitly.

Best regards,
Konstantin.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: MI usage inside a user-defined commands
  2005-07-06 21:26     ` Nick Roberts
  2005-07-06 21:28       ` Daniel Jacobowitz
@ 2005-07-06 21:41       ` Bob Rossi
  1 sibling, 0 replies; 13+ messages in thread
From: Bob Rossi @ 2005-07-06 21:41 UTC (permalink / raw)
  To: Nick Roberts; +Cc: Karganov Konstantin, Daniel Jacobowitz, gdb

On Thu, Jul 07, 2005 at 09:26:42AM +1200, Nick Roberts wrote:
> 
>  > I mean the "define" feature itself works fine under MI (that is expected), 
>  > but allows only CLI commands inside (that is not expected). From the first 
>  > view it looks like broken CLI-compatibility...
> 
> The manual says:
> 
>   A "user-defined command" is a sequence of GDB commands...
> 
> GDB command implicitly means CLI command.  I guess an equivalent MI command
> could be implemented to execute a sequence of MI commands, but I'm not sure
> that it would be needed.
> 
> I don't know why you expect "define", a CLI command to accept a list of
> MI commands.  Likewise, "source filename" and breakpoint command lists will
> only work with CLI commands.
> 
> What does seem wrong is that MI no longer works properly with queries:
> 
> (gdb) 
> -interpreter-exec console "b asdf"
> &"Function \"asdf\" not defined.\n"
> ~"Breakpoint 2 (asdf) pending.\n"
> ^done
> (gdb) 

I've noticed this. I was going to fix it if I had some time.
It won't work when with overloaded function breakpoints either.

Bob Rossi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: MI usage inside a user-defined commands
  2005-07-06 21:26     ` Nick Roberts
@ 2005-07-06 21:28       ` Daniel Jacobowitz
  2005-07-06 21:41       ` Bob Rossi
  1 sibling, 0 replies; 13+ messages in thread
From: Daniel Jacobowitz @ 2005-07-06 21:28 UTC (permalink / raw)
  To: Nick Roberts; +Cc: Karganov Konstantin, gdb

On Thu, Jul 07, 2005 at 09:26:42AM +1200, Nick Roberts wrote:
> What does seem wrong is that MI no longer works properly with queries:
> 
> (gdb) 
> -interpreter-exec console "b asdf"
> &"Function \"asdf\" not defined.\n"
> ~"Breakpoint 2 (asdf) pending.\n"
> ^done
> (gdb) 
> 
> The user should be asked:
> 
> Make breakpoint pending on future shared library load? (y or [n])

Yes, that does seem like a bug - but how would you perform the query?

-- 
Daniel Jacobowitz
CodeSourcery, LLC

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: MI usage inside a user-defined commands
  2005-07-06 13:46   ` Karganov Konstantin
  2005-07-06 13:50     ` Daniel Jacobowitz
@ 2005-07-06 21:26     ` Nick Roberts
  2005-07-06 21:28       ` Daniel Jacobowitz
  2005-07-06 21:41       ` Bob Rossi
  1 sibling, 2 replies; 13+ messages in thread
From: Nick Roberts @ 2005-07-06 21:26 UTC (permalink / raw)
  To: Karganov Konstantin; +Cc: Daniel Jacobowitz, gdb


 > I mean the "define" feature itself works fine under MI (that is expected), 
 > but allows only CLI commands inside (that is not expected). From the first 
 > view it looks like broken CLI-compatibility...

The manual says:

  A "user-defined command" is a sequence of GDB commands...

GDB command implicitly means CLI command.  I guess an equivalent MI command
could be implemented to execute a sequence of MI commands, but I'm not sure
that it would be needed.

I don't know why you expect "define", a CLI command to accept a list of
MI commands.  Likewise, "source filename" and breakpoint command lists will
only work with CLI commands.

What does seem wrong is that MI no longer works properly with queries:

(gdb) 
-interpreter-exec console "b asdf"
&"Function \"asdf\" not defined.\n"
~"Breakpoint 2 (asdf) pending.\n"
^done
(gdb) 

The user should be asked:

Make breakpoint pending on future shared library load? (y or [n])


Nick

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: MI usage inside a user-defined commands
  2005-07-06 13:50     ` Daniel Jacobowitz
@ 2005-07-06 13:57       ` Karganov Konstantin
  2005-07-07 12:21       ` Karganov Konstantin
  1 sibling, 0 replies; 13+ messages in thread
From: Karganov Konstantin @ 2005-07-06 13:57 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb


> The ability to use CLI syntax in MI mode is documented in the manual as
> an unsupported, transitional feature.
It is documented, that "MI accepts existing CLI commands" (section 24.4) 
and nothing is said about "unsupported" or "transitional" :)

> it's not to be used by frontends.
That is clear, since the output format will be the mess of CLI and MI 
output.

Best regards,
Konstantin.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: MI usage inside a user-defined commands
  2005-07-06 13:46   ` Karganov Konstantin
@ 2005-07-06 13:50     ` Daniel Jacobowitz
  2005-07-06 13:57       ` Karganov Konstantin
  2005-07-07 12:21       ` Karganov Konstantin
  2005-07-06 21:26     ` Nick Roberts
  1 sibling, 2 replies; 13+ messages in thread
From: Daniel Jacobowitz @ 2005-07-06 13:50 UTC (permalink / raw)
  To: Karganov Konstantin; +Cc: gdb

On Wed, Jul 06, 2005 at 05:32:22PM +0400, Karganov Konstantin wrote:
> 
> > > It seems that user-defined commands are always parsed by console cmd-line 
> > > interpreter (no matter what interpreter was specified).
> > 
> > Yes, that's correct.  define is a feature of the CLI, not of core GDB.
> > I think this is as designed.
> 
> This looks a little bit strange - when I switch to MI I can use both MI 
> and CLI syntax but suddenly get a error with MI command ("hey! I've just 
> switched to MI mode! what's the..."). 

The ability to use CLI syntax in MI mode is documented in the manual as
an unsupported, transitional feature.  It's for your convenience when
poking at MI by hand - it's not to be used by frontends.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: MI usage inside a user-defined commands
  2005-07-06 13:14 ` Daniel Jacobowitz
@ 2005-07-06 13:46   ` Karganov Konstantin
  2005-07-06 13:50     ` Daniel Jacobowitz
  2005-07-06 21:26     ` Nick Roberts
  0 siblings, 2 replies; 13+ messages in thread
From: Karganov Konstantin @ 2005-07-06 13:46 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb


> > It seems that user-defined commands are always parsed by console cmd-line 
> > interpreter (no matter what interpreter was specified).
> 
> Yes, that's correct.  define is a feature of the CLI, not of core GDB.
> I think this is as designed.

This looks a little bit strange - when I switch to MI I can use both MI 
and CLI syntax but suddenly get a error with MI command ("hey! I've just 
switched to MI mode! what's the..."). 

I mean the "define" feature itself works fine under MI (that is expected), 
but allows only CLI commands inside (that is not expected). From the first 
view it looks like broken CLI-compatibility...

Best regards,
Konstantin.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: MI usage inside a user-defined commands
  2005-07-06 12:31 Karganov Konstantin
@ 2005-07-06 13:14 ` Daniel Jacobowitz
  2005-07-06 13:46   ` Karganov Konstantin
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Jacobowitz @ 2005-07-06 13:14 UTC (permalink / raw)
  To: Karganov Konstantin; +Cc: gdb

On Wed, Jul 06, 2005 at 04:16:52PM +0400, Karganov Konstantin wrote:
> Hello, all.
> 
> It seems that user-defined commands are always parsed by console cmd-line 
> interpreter (no matter what interpreter was specified).

Yes, that's correct.  define is a feature of the CLI, not of core GDB.
I think this is as designed.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

^ permalink raw reply	[flat|nested] 13+ messages in thread

* MI usage inside a user-defined commands
@ 2005-07-06 12:31 Karganov Konstantin
  2005-07-06 13:14 ` Daniel Jacobowitz
  0 siblings, 1 reply; 13+ messages in thread
From: Karganov Konstantin @ 2005-07-06 12:31 UTC (permalink / raw)
  To: gdb

Hello, all.

It seems that user-defined commands are always parsed by console cmd-line 
interpreter (no matter what interpreter was specified).
I tried to print a variable from the user-defined cmd and directly from 
the interpreter:

(gdb)
define aaaa
&"define aaaa\n"
>-data-evaluate-expression i
>end
^done
(gdb)
aaaa
&"aaaa\n"
&"Undefined command: \"-data-evaluate-expression\".  Try \"help\".\n"
^error,msg="Undefined command: \"-data-evaluate-expression\".  Try 
\"help\"."
(gdb)
-data-evaluate-expression i
^done,value="0"
(gdb)

I use gdb 6.3 built from sources on RedHat 9. Debug session is started as 
"gdb --i=mi a.out"

Is is a bug or a feature?

Best regards,
Konstantin.


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2005-07-07 21:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-06 14:02 MI usage inside a user-defined commands Alain Magloire
  -- strict thread matches above, loose matches on Subject: below --
2005-07-06 12:31 Karganov Konstantin
2005-07-06 13:14 ` Daniel Jacobowitz
2005-07-06 13:46   ` Karganov Konstantin
2005-07-06 13:50     ` Daniel Jacobowitz
2005-07-06 13:57       ` Karganov Konstantin
2005-07-07 12:21       ` Karganov Konstantin
2005-07-07 13:03         ` Daniel Jacobowitz
2005-07-07 14:16           ` Karganov Konstantin
2005-07-07 21:47             ` Nick Roberts
2005-07-06 21:26     ` Nick Roberts
2005-07-06 21:28       ` Daniel Jacobowitz
2005-07-06 21:41       ` Bob Rossi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).