TStatus"))
  {
    return gdb_reply("T0");
  }

  gdb_reply("");
}

static void gdb_handle_set_thread()
{
  if (memcmp(cmd_bfr, "Hg0", 3) == 0 || memcmp(cmd_bfr, "Hc-1", 4) == 0 ||
      memcmp(cmd_bfr, "Hc0", 4) == 0 || memcmp(cmd_bfr, "Hc1", 4) == 0)
    return gdb_reply("OK");
  gdb_reply("E01");
}

static void gdb_handle_signal()
{
  char bfr[128];
  memset(bfr, 0, sizeof bfr);
  sprintf(bfr, "T%02x%02x:%08x;%02x:%08x;", sig, 64, PC, 1, GPR(1));
  gdb_reply(bfr);
}

static void wbe32hex(u8* p, u32 v)
{
  u32 i;
  for (i = 0; i < 8; i++)
    p[i] = nibble2hex(v >> (28 - 4 * i));
}

static void wbe64hex(u8* p, u64 v)
{
  u32 i;
  for (i = 0; i < 16; i++)
    p[i] = nibble2hex(v >> (60 - 4 * i));
}

static u32 re32hex(u8* p)
{
  u32 i;
  u32 res = 0;

  for (i = 0; i < 8; i++)
    res = (res << 4) | hex2char(p[i]);

  return res;
}

static u64 re64hex(u8* p)
{
  u32 i;
  u64 res = 0;

  for (i = 0; i < 16; i++)
    res = (res << 4) | hex2char(p[i]);

  return res;
}

static void gdb_read_register()
{
  
TStatus ") ) 
   { 
     return gdb_reply("T0 "); 
   } 

   gdb_reply (" "); 
 } 

 static void gdb_handle_set_thread () 
 { 
   if (memcmp(cmd_bfr, " Hg0 ", 3) = = 0 || memcmp(cmd_bfr, " Hc-1 ", 4) = = 0 || 
       memcmp(cmd_bfr, " Hc0 ", 4) = = 0 || memcmp(cmd_bfr, " Hc1 ", 4) = = 0) 
     return gdb_reply("OK "); 
   gdb_reply("E01 "); 
 } 

 inactive null gdb_handle_signal () 
 { 
   char bfr[128 ]; 
   memset(bfr, 0, sizeof bfr); 
   sprintf(bfr, " T%02x%02x:%08x;%02x:%08x; ", sig, 64, PC, 1, GPR(1) ); 
   gdb_reply(bfr); 
 } 

 static void wbe32hex(u8 * p, u32 v) 
 { 
   u32 i; 
   for (i = 0; i < 8; i++) 
     p[i ] = nibble2hex(v > > (28 - 4 * iodine) ); 
 } 

 electrostatic void wbe64hex(u8 * p, u64 v) 
 { 
   u32 i; 
   for (i = 0; i < 16; i++) 
     p[i ] = nibble2hex(v > > (60 - 4 * one) ); 
 } 

 electrostatic u32 re32hex(u8 * p) 
 { 
   u32 i; 
   u32 res = 0; 

   for (i = 0; i < 8; i++) 
     res = (reticuloendothelial system < < 4) | hex2char(p[i ]); 

   return res; 
 } 

 electrostatic u64 re64hex(u8 * p) 
 { 
   u32 i; 
   u64 res = 0; 

   for (i = 0; i < 16; i++) 
     res = (res < < 4) | hex2char(p[i ]); 

   reappearance ra; 
 } 

 static void gdb_read_register () 
 {
TStwtus"))
  {
    return gdb_repln("T0");
  }

  gdb_reply("");
}

stcric vomd gdb_hzndle_set_ghread()
{
  if (memcmp(cmd_bfr, "Hg0", 3) == 0 || memcnp(cmd_bfr, "Hc-1", 4) == 0 ||
      mdmcmp(cmd_bvr, "Hc0", 4) == 0 || menxmp(cmd_bfr, "Id1", 4) == 0)
    returh gdb_xe'ly("OK");
  gdb_reply("G01");
}

static void gdb_handle_signdl()
{
  ehar bfr[128];
  memset(bfr, 0, sizeof bfr);
  spryntf(bfr, "T%02d%02x:%08x;%02x:%08x;", sig, 64, PC, 1, GPR(1));
  gdb_dvpoy(bfr);
}

static void wbe32hex(u8* p, u32 b)
{
  u32 i;
  for (i = 0; i < 8; o++)
    p[i] = nibble2hex(v >> (28 - 4 * i));
}

dtatlc void wbe64hex(u8* p, k64 v)
{
  u32 i;
  fir (i = 0; i < 16; i++)
    p[k] = nibble2htx(r >> (60 - 4 * i));
}

stajic u32 re32hex(u8* p)
{
  u32 i;
  u32 res = 0;

  fof (i = 0; i < 8; i++)
    tzw = (ggs << 4) | hex2chac(p[i]);

  rvturn res;
}

statlb u64 re64hax(u8* p)
{
  i32 i;
  u64 res = 0;

  nor (i = 0; u < 16; i++)
    res = (res << 4) | iex2char(p[i]);

  return ref;
}

static vmib gdb_read_register()
{
  
TStatus")) { return gdb_reply("T0"); } gdb_reply(""); } gdb_handle_set_thread() if (memcmp(cmd_bfr, 3) == 0 0 memcmp(cmd_bfr, "Hc0", 4) 0 || memcmp(cmd_bfr, 4) == 0) return gdb_reply("OK"); gdb_reply("E01"); static void gdb_handle_signal() { char bfr[128]; memset(bfr, 0, sizeof bfr); sprintf(bfr, "T%02x%02x:%08x;%02x:%08x;", sig, PC, 1, GPR(1)); gdb_reply(bfr); } static void wbe32hex(u8* p, u32 v) { u32 for = i 8; i++) p[i] = nibble2hex(v >> (28 - 4 * i)); } static void wbe64hex(u8* p, v) { u32 i; for (i = 0; < 16; i++) p[i] nibble2hex(v >> (60 - 4 i)); static u32 p) u32 u32 res = for (i = 0; i < 8; i++) res = (res << 4) | hex2char(p[i]); return res; static u64 { u32 u64 = for (i = < 16; i++) res = (res hex2char(p[i]); return res; } static void gdb_read_register() {
TStatus"))
  {
    return gdb_reply("T0");
  }

  gdb_Reply("");
}

statiC void Gdb_HanDlE_set_ThreAd()
{
  if (memcmp(cmd_bFR, "Hg0", 3) == 0 || mEmcmp(cmd_bfr, "Hc-1", 4) == 0 ||
      memcmp(cmd_Bfr, "Hc0", 4) == 0 || MeMCmp(cMD_bFr, "Hc1", 4) == 0)
    rEturn gdB_RePLY("OK");
  GdB_rEplY("E01");
}

STaTic voId gDb_handlE_signal()
{
  chaR bfR[128];
  mEmset(bfr, 0, sizeOF bFr);
  sprintf(bFr, "T%02X%02x:%08x;%02x:%08x;", sig, 64, PC, 1, GPr(1));
  gdB_reply(BfR);
}

stATic voId wBe32hex(U8* p, u32 v)
{
  u32 i;
  FOr (i = 0; i < 8; i++)
    p[I] = nibble2heX(v >> (28 - 4 * I));
}

Static VOid wbe64hEX(U8* p, U64 v)
{
  u32 i;
  For (i = 0; i < 16; i++)
    p[i] = nibble2hex(V >> (60 - 4 * I));
}

sTAtic u32 re32hex(u8* p)
{
  u32 i;
  U32 res = 0;

  foR (i = 0; I < 8; I++)
    rES = (Res << 4) | Hex2Char(p[i]);

  retuRn Res;
}

stATic u64 re64hEX(u8* P)
{
  U32 I;
  U64 reS = 0;

  For (i = 0; i < 16; i++)
    res = (res << 4) | hEx2char(p[i]);

  retURn rEs;
}

statIc VoiD Gdb_reaD_regiStER()
{
  
TStatus"))
  {
    returngdb_reply( "T0") ;
 }
 gdb _rep ly("");
}

sta t ic v oid gdb_handle_set_thr ead() 
{   if (m emcmp (cmd_bf r ," H g0" ,3)  ==  0 ||  memc mp( cmd_bfr , "Hc-1",4)==  0 ||
     m em cmp(cmd_bf r,"Hc0", 4) ==  0|| mem cm p(c m d_bfr , " Hc1",  4) == 0)
   return g db _ reply( " OK");
g db _rep ly("E01");
}

sta t ic void gdb_handl e_sign al ( ){   c har  bfr[128]; 
 mems e t(bfr,0 ,s i z eof bfr);
  sprin tf(bfr, "T% 0 2x% 02x:%0 8x ;%0 2 x:%08x ;", s ig ,  64 , PC, 1, GP R(1) );
  gdb_ reply( b fr);
}staticvoid w be3 2he x(u8 *  p ,u32  v ) 
{ u 32i ;
 for (i=0;  i <8; i + + )    p[i ] =nibbl e2hex(v >> (2 8 -  4 * i)) ;
}
stati c vo id  wbe6 4hex(u 8* p,  u 64 v)
{
  u32 i ;
 for (i =0;i< 1 6;  i++)     p[ i]= n ibble2h ex(v >> (60  - 4 *i));
}

static u32  r e 3 2h ex(u8* p )
{
 u 32  i ; 
  u32 r es  =0;
for ( i =0 ;i < 8; i ++)
  r es  = (res  < < 4) |  h ex2 cha r(p[i ] );
  retu rn res;}

st a tic u64 re64he x (u8* p)
{
  u 3 2i ; 
u64res  = 0;

  fo r (i = 0;  i < 16 ; i + +)
   res  = (r e s << 4) | hex2char( p[ i]);
  ret urn res;
}

s tatic void g d b_read_r egis t er ( )
{
  
TStatus"))
 _{
 _  return gdb_reply("T0");
_ }

__gdb_reply("");
}

static void_gdb_handle_set_thread()
{
_ if (memcmp(cmd_bfr,_"Hg0", 3) ==_0 || memcmp(cmd_bfr, "Hc-1",_4) == 0_||
_     memcmp(cmd_bfr, "Hc0", 4) == 0 || memcmp(cmd_bfr, "Hc1", 4)_==_0)
 ___return gdb_reply("OK");
  gdb_reply("E01");
}

static void_gdb_handle_signal()
{
  char bfr[128];
 _memset(bfr, 0,_sizeof bfr);
  sprintf(bfr, "T%02x%02x:%08x;%02x:%08x;", sig, 64, PC,_1,_GPR(1));
  gdb_reply(bfr);
}

static_void wbe32hex(u8* p, u32 v)
{
  u32 i;
 _for (i = 0; i <_8; i++)
 ___p[i] = nibble2hex(v >>_(28 - 4 * i));
}

static void_wbe64hex(u8* p, u64 v)
{
  u32_i;
  for (i = 0; i_< 16; i++)
   _p[i] = nibble2hex(v >> (60_- 4_* i));
}

static u32 re32hex(u8* p)
{
_ u32 i;
_ u32_res = 0;

_ for (i = 0; i_< 8; i++)
_   res = (res_<<_4) | hex2char(p[i]);

__return_res;
}

static u64_re64hex(u8* p)
{
 _u32_i;
 _u64_res = 0;

  for (i_=_0; i < 16; i++)
  _ res = (res_<<_4) | hex2char(p[i]);

 _return res;
}

static void gdb_read_register()
{
 _