Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Re: Query user with gdb MI intepreter
@ 2008-10-23  6:45 Nick Roberts
  2008-10-23 10:21 ` Denis PILAT
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Roberts @ 2008-10-23  6:45 UTC (permalink / raw)
  To: Denis PILAT; +Cc: gdb


> I have a problem with the current gdb that, run from an eclipse front-end
> using MI interpreter, query the user with defaulted_query () to prompt him to
> "Quit this debugging session?" .
>
> Is that a normal behavior or not ?

MI has no provision for handling query functions

> I thought that gdb should not query user when using MI mode, but I can we
> wrong, that's my point.

MI avoids queries generated by CLI commands by implicitly answering them in the
affirmative (by making deprecated_query_hook return 1).

> Here is part of th back trace. As you will see, we
> have an assertion that comes from a problem with the frame unwinder, but I
> want first to make sure that this assertion can request for user interaction
> or no.  The command that leads to the assertion is a simple -exec-next

This query arose (indirectly) from an MI command.  Only a few MI commands
deal with queries, e.g, -break-insert for pending breakpoints and and
breakpoint menus, and they just take a default action.

If you want to request for user interaction you will need to give MI a richer
set of output records.  Good luck!


-- 
Nick                                           http://www.inet.net.nz/~nickrob


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

* Re: Query user with gdb MI intepreter
  2008-10-23  6:45 Query user with gdb MI intepreter Nick Roberts
@ 2008-10-23 10:21 ` Denis PILAT
  2008-10-23 11:08   ` Nick Roberts
  0 siblings, 1 reply; 7+ messages in thread
From: Denis PILAT @ 2008-10-23 10:21 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb



Nick Roberts wrote:
>> I have a problem with the current gdb that, run from an eclipse front-end
>> using MI interpreter, query the user with defaulted_query () to prompt him to
>> "Quit this debugging session?" .
>>
>> Is that a normal behavior or not ?
>>     
>
> MI has no provision for handling query functions
>
>   
>> I thought that gdb should not query user when using MI mode, but I can we
>> wrong, that's my point.
>>     
>
> MI avoids queries generated by CLI commands by implicitly answering them in the
> affirmative (by making deprecated_query_hook return 1).
>
>   
>> Here is part of th back trace. As you will see, we
>> have an assertion that comes from a problem with the frame unwinder, but I
>> want first to make sure that this assertion can request for user interaction
>> or no.  The command that leads to the assertion is a simple -exec-next
>>     
>
> This query arose (indirectly) from an MI command.  Only a few MI commands
> deal with queries, e.g, -break-insert for pending breakpoints and and
> breakpoint menus, and they just take a default action.
>
> If you want to request for user interaction you will need to give MI a richer
> set of output records.  Good luck!
>   
No that's not what I want.
Is the actual behavior correct from your point of view ? Let me explain it:
It's a corner case, but does an assertion in gdb that using MI 
interpreter should query user for quiting the program or ?
Today we don't go thru deprecated_query_hook when gdb asserts so user is 
prompted.

If actual behavior is not correct, then I will propose a simple patch 
that is already in place in my version of gdb sources.
Denis


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

* Re: Query user with gdb MI intepreter
  2008-10-23 10:21 ` Denis PILAT
@ 2008-10-23 11:08   ` Nick Roberts
  2008-10-23 12:57     ` Denis PILAT
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Roberts @ 2008-10-23 11:08 UTC (permalink / raw)
  To: Denis PILAT; +Cc: gdb

 > If actual behavior is not correct, then I will propose a simple patch 
 > that is already in place in my version of gdb sources.

I don't think anyone has considered how MI should behave after an internal
error which really means there is a bug in GDB anyway.  Why not just submit
your patch for consideration?

-- 
Nick                                           http://www.inet.net.nz/~nickrob


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

* Re: Query user with gdb MI intepreter
  2008-10-23 11:08   ` Nick Roberts
@ 2008-10-23 12:57     ` Denis PILAT
  0 siblings, 0 replies; 7+ messages in thread
From: Denis PILAT @ 2008-10-23 12:57 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb



Nick Roberts wrote:
>  > If actual behavior is not correct, then I will propose a simple patch 
>  > that is already in place in my version of gdb sources.
>
> I don't think anyone has considered how MI should behave after an internal
> error which really means there is a bug in GDB anyway. 
There is, but I don't have any patch to submit about it, sorry.
dwarf2_restore_rule() is called from execute_cfa_program() with 
fs->initial.reg set to 0 which leads to a gdb_assert().
That, for sure, comes from a problem we have in our in-house compiler 
that do not generate right debug information.


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

* Re: Query user with gdb MI intepreter
  2008-10-23 10:30 ` Vladimir Prus
@ 2008-10-23 11:08   ` Denis PILAT
  0 siblings, 0 replies; 7+ messages in thread
From: Denis PILAT @ 2008-10-23 11:08 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb



Vladimir Prus wrote:
> Denis PILAT wrote:
>
>   
>> Hi all
>>
>> I have a problem with the current gdb that, run from an eclipse
>> front-end using MI interpreter, query the user with defaulted_query ()
>> to prompt him to "Quit this debugging session?" .
>> Is that a normal behavior or not ?
>> I thought that gdb should not query user when using MI mode, but I can
>> we wrong, that's my point.
>> Here is part of th back trace. As you will see, we have an assertion
>> that comes from a problem with the frame unwinder, but I want first to
>> make sure that this assertion can request for user interaction or no.
>> The command that leads to the assertion is a simple -exec-next
>>     
>
> I would have expected this query to be auto-asnwered as "yes". Is this not
> happening? If not, and GDB actually waits till the user types "yes", it's
> clearly a bug.
>
> - Volodya
>
>
>
>   
Here is a proposal that prevents assert in gdb to query user.
The inconvenient (to me) is that when gdb ask user for generating a core 
file, it *will* be generated and the user may not be aware of that.
I've though to disable the core file generation in MI mode, but I did 
not so far. waiting for your feedback.

-- 
Denis


2008-10-23  Denis Pilat <denis.pilat@st.com>

	* utils.c (defaulted_query): return the default value when using MI
	interpreter.

Index: utils.c
===================================================================
--- utils.c     (revision 293)
+++ utils.c     (working copy)
@@ -1180,7 +1180,7 @@ defaulted_query (const char *ctlstr, con

   /* Automatically answer the default value if input is not from the user
      directly, or if the user did not want prompts.  */
-  if (!input_from_terminal_p () || !caution)
+  if (!input_from_terminal_p () || !caution || ui_out_is_mi_like_p (uiout))
     return def_value;

   if ((instream == stdin || instream == NULL) && deprecated_query_hook)



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

* Re: Query user with gdb MI intepreter
  2008-10-21 12:18 Denis PILAT
@ 2008-10-23 10:30 ` Vladimir Prus
  2008-10-23 11:08   ` Denis PILAT
  0 siblings, 1 reply; 7+ messages in thread
From: Vladimir Prus @ 2008-10-23 10:30 UTC (permalink / raw)
  To: gdb

Denis PILAT wrote:

> Hi all
> 
> I have a problem with the current gdb that, run from an eclipse
> front-end using MI interpreter, query the user with defaulted_query ()
> to prompt him to "Quit this debugging session?" .
> Is that a normal behavior or not ?
> I thought that gdb should not query user when using MI mode, but I can
> we wrong, that's my point.
> Here is part of th back trace. As you will see, we have an assertion
> that comes from a problem with the frame unwinder, but I want first to
> make sure that this assertion can request for user interaction or no.
> The command that leads to the assertion is a simple -exec-next

I would have expected this query to be auto-asnwered as "yes". Is this not
happening? If not, and GDB actually waits till the user types "yes", it's
clearly a bug.

- Volodya



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

* Query user with gdb MI intepreter
@ 2008-10-21 12:18 Denis PILAT
  2008-10-23 10:30 ` Vladimir Prus
  0 siblings, 1 reply; 7+ messages in thread
From: Denis PILAT @ 2008-10-21 12:18 UTC (permalink / raw)
  To: gdb

Hi all

I have a problem with the current gdb that, run from an eclipse 
front-end using MI interpreter, query the user with defaulted_query () 
to prompt him to "Quit this debugging session?" .
Is that a normal behavior or not ?
I thought that gdb should not query user when using MI mode, but I can 
we wrong, that's my point.
Here is part of th back trace. As you will see, we have an assertion 
that comes from a problem with the frame unwinder, but I want first to 
make sure that this assertion can request for user interaction or no.
The command that leads to the assertion is a simple -exec-next


#6 0x0805ba75 in defaulted_query (ctlstr=0x83459ac "%s\nQuit this 
debugging session? ", defchar=0 '\0',args=0xbfff8ab4 "6r\t\030\001") at 
/local/pd10/st200/svn/branches/20080922_ST200GDB_6.8-ST-2.0/src/gdb/utils.c:1215
#7 0x0805bc36 in query (ctlstr=0x83459ac "%s\nQuit this debugging 
session? ") at 
/local/pd10/st200/svn/branches/20080922_ST200GDB_6.8-ST-2.0/src/gdb/utils.c:1312
#8 0x0805be92 in internal_vproblem (problem=0x83e04a0, file=0x838e684 
"/local/pd10/st200/svn/branches/20080922_ST200GDB_6.8-ST-2.0/src/gdb/dwarf2-frame.c", 
line=<value optimized out>, fmt=0x8342d79 "%s: Assertion `%s' failed.", 
ap=0xbfff8b2c "T&#65533;\b\016&#65533;\b") at 
/local/pd10/st200/svn/branches/20080922_ST200GDB_6.8-ST-2.0/src/gdb/utils.c:746
#9 0x08059723 in internal_verror (file=0x838e684 
"/local/pd10/st200/svn/branches/20080922_ST200GDB_6.8-ST-2.0/src/gdb/dwarf2-frame.c", 
line=280, fmt=0x8342d79 "%s: Assertion `%s' failed.", ap=0xbfff8b2c 
"T&#65533;\b\016&#65533;\b") at 
/local/pd10/st200/svn/branches/20080922_ST200GDB_6.8-ST-2.0/src/gdb/utils.c:805
#10 0x08059759 in internal_error (file=0x838e684 
"/local/pd10/st200/svn/branches/20080922_ST200GDB_6.8-ST-2.0/src/gdb/dwarf2-frame.c", 
line=280, string=0x8342d79 "%s: Assertion `%s' failed.") at 
/local/pd10/st200/svn/branches/20080922_ST200GDB_6.8-ST-2.0/src/gdb/utils.c:814
#11 0x0812c0a8 in dwarf2_restore_rule (gdbarch=<value optimized out>, 
reg_num=<value optimized out>, fs=0x983dbc0, eh_frame_p=1) at 
/local/pd10/st200/svn/branches/20080922_ST200GDB_6.8-ST-2.0/src/gdb/dwarf2-frame.c:280
#12 0x0812c25f in execute_cfa_program (insn_ptr=0x9988eba "\f\f\020", 
insn_end=0x9988ec0 "\034", next_frame=0x96c5900, fs=0x983dbc0, 
eh_frame_p=1) at 
/local/pd10/st200/svn/branches/20080922_ST200GDB_6.8-ST-2.0/src/gdb/dwarf2-frame.c:360



Thanks for your feedback,
Denis


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

end of thread, other threads:[~2008-10-23 12:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-23  6:45 Query user with gdb MI intepreter Nick Roberts
2008-10-23 10:21 ` Denis PILAT
2008-10-23 11:08   ` Nick Roberts
2008-10-23 12:57     ` Denis PILAT
  -- strict thread matches above, loose matches on Subject: below --
2008-10-21 12:18 Denis PILAT
2008-10-23 10:30 ` Vladimir Prus
2008-10-23 11:08   ` Denis PILAT

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox