[RTEMS Project] #3766: potential patch to libbsp/shared/gdbstub/rtems-stub-glue.c for gdb NONSTOP mode

RTEMS trac trac at rtems.org
Fri Jul 12 15:22:51 UTC 2019


#3766: potential patch to libbsp/shared/gdbstub/rtems-stub-glue.c for gdb NONSTOP
mode
---------------------------+--------------------
  Reporter:  Jeffrey Hill  |      Owner:  (none)
      Type:  enhancement   |     Status:  new
  Priority:  normal        |  Milestone:
 Component:  bsps          |    Version:
  Severity:  minor         |   Keywords:
Blocked By:                |   Blocking:
---------------------------+--------------------
 FWIW, I am reviewing this change I made to the shared gdb stub, and
 perhaps it can be considered to be a good idea if supporting newer gdb
 modes where the threads are not all of them stopped when gdb is looking at
 the system.

 This is against a pre-release RTEMS 4.11 in function
 rtems_gdb_stub_get_thread_regs

 {{{
 diff --git a/c/src/lib/libbsp/shared/gdbstub/rtems-stub-glue.c
 b/c/src/lib/libbsp/shared/gdbstub/rtems-stub-glue.c
 index 06dfc8a..98fd509 100644
 --- a/c/src/lib/libbsp/shared/gdbstub/rtems-stub-glue.c
 +++ b/c/src/lib/libbsp/shared/gdbstub/rtems-stub-glue.c
 @@ -278,16 +278,21 @@ int rtems_gdb_stub_get_thread_regs(
    unsigned int *registers
  )
  {
 -   Thread_Control *th;
 -
 -   th= rtems_gdb_index_to_stub_id(thread);
 -
 -   if( th )
 -   {
 -      rtems_gdb_stub_get_registers_from_context( registers, th );
 -      return 1;
 -   }
 -   return 0;
 +  bool success = false;
 +  Thread_Control * const pThrUnlocked = rtems_gdb_index_to_stub_id (
 thread );
 +  if ( pThrUnlocked ) {
 +    Objects_Locations loc;
 +    Thread_Control * const pThr =
 +                            _Thread_Get ( pThrUnlocked->Object.id, &loc
 );
 +    if( pThr && loc == OBJECTS_LOCAL ) {
 +      if ( pThr != _Thread_Executing ) {
 +        rtems_gdb_stub_get_registers_from_context( registers, pThr );
 +        success = true;
 +      }
 +      _Thread_Enable_dispatch ();
 +    }
 +  }
 +  return success;
  }

  /* Set thread registers, return 0 if thread does not
 }}}

--
Ticket URL: <http://devel.rtems.org/ticket/3766>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list