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 to propagate GDB's knowledge of the executing state to frontend


On 11/13/2012 10:24 PM, Luis Machado wrote:
> On 11/13/2012 07:57 PM, Tom Tromey wrote:
>> Luis>  Should frontends relying on MI information treat ^error specially and
>> Luis>  not look for any *stopped records?
>>
>> I don't know the answer to this.  I did find this though:
>>
>> http://sourceware.org/bugzilla/show_bug.cgi?id=7778
>>
>> I tend to think it would be cleanest if gdb were to emit a *stopped in
>> case of error -- but only if it previously emitted *running.  I don't
>> know how feasible this is.
> 
> Right. That seems to be what Ali's patch is attempting to address, in order to improve the relationship with the frontends.

It might be a worthy goal (*), but IIUC that patch breaks things like

define foo
  step
  step
end

where an error happens while handling the first step, we'll go on
with the command list anyway, instead of canceling the whole canned
command.

(*) - though if the frontend is going to do a full refresh
I don't see that much point.

> 
>>
>> Luis>  The MI specification gives room for slightly different interpretations
>> Luis>  unfortunately.
>>
>> For me, the text for "*running" is pretty clear:
>>
>>       The frontend should assume that no interaction with a
>>       running thread is possible after this notification is produced.
>>
>> I'm curious where the text is that gives room for another approach.

Well, an "except when things go wrong" is missing here.  :-)

> I wanted to know what is to be done once an ^error is thrown at the frontend and how it should behave.
> 
> There is this text:
> 
> "There's no guarantee that whenever an MI command reports an error, gdb or the target are in any specific state, and especially, the state is not reverted to the state before the MI command was processed. Therefore, whenever an MI command results in an error, we recommend that the frontend refreshes all the information shown in the user interface."
> 
> It is not clear how things need to be refreshed, specially when the frontend needs to assume a thread/inferior is still running after it saw ^running but did not see a *stopped record, though it did see an ^error. But ^error does not imply the target has stopped.
> 
> So it needs to refresh information, but should it forget the target was running and attempt to fetch data anyway or should it do something else?
> 
> In the case of all-stop mode, we know the inferior is stopped. This may not be true for non-stop though.

Yes, this is what I was alluding to when I said that an error, frontends should
just no longer trust any of their state, and issue a full refresh.  I assumed
frontends to be already doing this.  -thread-info includes a "state" field for
each thread that says whether the thread is running or not.  The
finish_thread_state_cleanup cleanups are there to make sure the "state" field
ends up correct on errors:

-thread-info
^done,threads=[{id="1",target-id="Thread 0x7ffff7fce740 (LWP 26570)",name="gdb",frame={level="0",addr="0x0000000000457bcb",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fffffffdc78"}],file="../../src/gdb/gdb.c",fullname="/home/pedro/gdb/mygit/src/gdb/gdb.c",line="29"},state="stopped",core="0"}],current-thread-id="1"
(gdb)

I guess this means the frontend in question is either not issuing that
command, or not reading that "state" field.

-- 
Pedro Alves


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