how to debug gdb?

Tomasz Gajewski tomga at wp.pl
Mon May 10 00:27:32 CEST 2021


Followup to my own message.

Tomasz Gajewski <tomga at wp.pl> writes:

> ... there are two 'asynchronous' operations that 'gdb_monitor'
> intercepts quickly one after another:
>
>  * pthread create
>  * service announce
>
> and it seems that if they are executed too quickly by debugged program
> then there is a hang.

Given that there are issues with 'ssh_terminal' stability (issue #4095
https://github.com/genodelabs/genode/issues/4095) I wasn't sure if
observed hangs when executing those commands (creating thread and
announcing service) quickly weren't a sign of some problem in
'ssh_terminal' itself. To verify I extended 'test-gdb_monitor' with
announcement of simple LOG service (based on test code from
os/src/test/init/main.cc).

Using this test I confifmed that:

 * creating thread (using pthread_create) and announcing a service
   executed one after another quickly cause a hang when executed with
   'gdb_monitor'

 * it happens no matter which is first

 * adding busy loop between them eliminates a hang problem (no matter
   which comes first)

 * when executed on Nova announcing a new service causes creation of two
   threads visible in gdb_monitor - I think that this observation can be
   really important


I don't know internals well enough but I think that either:

 * creating threads quickly may cause problems for gdb_monitor

 * creating threads from different worlds (posix thread and some
   internal Genode service threads which I assume are created for
   service) may require some special care.


Hopefully those observations and thoughts will be helpful.

Regards
Tomasz



More information about the users mailing list