Changeset 443 for trunk/libs/mini-libc


Ignore:
Timestamp:
May 16, 2018, 4:15:22 PM (4 years ago)
Author:
alain
Message:

Fix few bugs whike debugging the sort multi-thread application.

Location:
trunk/libs/mini-libc
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/libs/mini-libc/stdio.c

    r439 r443  
    328328}
    329329
    330 ///////////////////////////////////
    331 int display_vmm( unsigned int pid )
     330//////////////////////////////////
     331int display_vmm( unsigned int cxy,
     332                 unsigned int pid )
    332333{
    333334    return hal_user_syscall( SYS_DISPLAY,
    334335                             DISPLAY_VMM,
    335                              (reg_t)pid, 0, 0 );
    336 }
    337 
    338 ////////////////////////////////
     336                             (reg_t)cxy,
     337                             (reg_t)pid, 0 );
     338}
     339
     340////////////////////////////////////
    339341int display_sched( unsigned int cxy,
    340342                   unsigned int lid )
     
    383385}
    384386
    385 //////////////////////////////////
    386 int trace( unsigned int operation,
    387            unsigned int pid,
    388            unsigned int trdid )
     387///////////////////////////////
     388int trace( unsigned int active,
     389           unsigned int cxy,
     390           unsigned int lid )
    389391{
    390392    return hal_user_syscall( SYS_TRACE,
    391                              (reg_t)pid,
    392                              (reg_t)trdid, 0, 0 );
    393 }
    394 
    395 
     393                             (reg_t)active,
     394                             (reg_t)cxy,
     395                             (reg_t)lid, 0 );
     396}
     397
     398
  • trunk/libs/mini-libc/stdio.h

    r439 r443  
    402402/***************************************************************************************
    403403 * This debug function displays on the kernel terminal TXT0
    404  * the state of the process VMM identified by the <pid> argument.
     404 * the state of the VMM forthe process <pid>, in cluster <cxy>.
    405405 * It can be called by any thread running in any cluster.
    406406 ***************************************************************************************
     
    408408 * @ return 0 if success / return -1 if illegal argument.
    409409 **************************************************************************************/
    410 int display_vmm( unsigned int  pid );
     410int display_vmm( unsigned int  cxy,
     411                 unsigned int  pid );
    411412
    412413/***************************************************************************************
     
    460461
    461462/*****************************************************************************************
    462  * This debug function is used to activate / desactivate the trace for a thread
    463  * identified by the <trdid> and <pid> arguments.
    464  * It can be called by any other thread in the same process.
    465  *****************************************************************************************
    466  * @ operation  : operation type.
    467  * @ pid        : process identifier.
    468  * @ trdid      : thread identifier.
     463 * This debug function is used to activate / desactivate the context switches trace
     464 * for a core identified by the <cxy> and <lid> arguments.
     465 * It can be called by any thread running in any cluster.
     466 *****************************************************************************************
     467 * @ active     : activate trace if non zero / desactivate if zero.
     468 * @ cxy        : cluster identifier.
     469 * @ lid        : core local index.
    469470 * @ returns O if success / returns -1 if illegal arguments.
    470471 ****************************************************************************************/
    471 int trace( unsigned int operation,
    472            unsigned int pid,
    473            unsigned int trdid );
     472int trace( unsigned int active,
     473           unsigned int cxy,
     474           unsigned int lid );
    474475
    475476
  • trunk/libs/mini-libc/stdlib.c

    r441 r443  
    553553    printf("\n[ERROR] in %s : not implemented yet : do nothing\n", __FUNCTION__ );
    554554}
     555
     556///////////
     557void idbg()
     558{
     559   char          cmd;
     560   unsigned int  cxy;
     561   unsigned int  lid;
     562   unsigned int  txt;
     563   unsigned int  active;
     564
     565   while( 1 )
     566   {
     567        printf("\n[idbg] cmd = ");
     568        cmd = (char)getchar();
     569
     570        if( cmd == 'h' )
     571        {
     572            printf("h\n"
     573                   "p : display on TXT0 process descriptors in cluster[cxy]\n"
     574                   "s : display on TXT0 scheduler state for core[cxy,lid]\n"
     575                   "v : display on TXT0 VMM for calling process in cluster [cxy]\n"
     576                   "t : display on TXT0 process decriptors attached to TXT[tid]\n"
     577                   "y : activate/desactivate trace for core[cxy,lid]\n"
     578                   "x : force calling process to exit\n"
     579                   "c : resume calling process execution\n"
     580                   "h : list supported commands\n");
     581        }
     582        else if( cmd == 'p' )
     583        {
     584            printf("p / cxy = ");
     585            cxy = getint();
     586            display_cluster_processes( cxy );
     587        }
     588        else if( cmd == 's' )
     589        {
     590            printf("s / cxy = ");
     591            cxy = getint();
     592            printf(" / lid = ");
     593            lid = getint();
     594            display_sched( cxy , lid );
     595        }
     596        else if( cmd == 'v' )
     597        {
     598            printf("v / cxy = ");
     599            cxy = getint();
     600            display_vmm( cxy , (unsigned int)getpid() );
     601        }
     602        else if( cmd == 't' )
     603        {
     604            printf("t / txt_id = ");
     605            txt = getint();
     606            display_txt_processes( txt );
     607        }
     608        else if( cmd == 'y' )
     609        {
     610            printf("y / active = ");
     611            active = getint();
     612            printf(" / cxy = ");
     613            cxy    = getint();
     614            printf(" / lid = ");
     615            lid    = getint();
     616            trace( active , cxy , lid );
     617        }
     618        else if( cmd == 'x' )
     619        {
     620            printf("x\n");
     621            exit( 0 );
     622        }
     623        else if( cmd == 'c' )
     624        {
     625            printf("c\n");
     626            break;
     627        }
     628    }
     629}  // end idbg()
     630
     631
     632
  • trunk/libs/mini-libc/stdlib.h

    r439 r443  
    130130int rand();
    131131
     132/*********************************************************************************************
     133 * This blocking function implements an user-level interactive debugger that can be
     134 * introduced in any user application to display various kernel distributed structures
     135 * related to the calling process. The supported commands are:
     136 * - p (cxy)     : display all processes descriptors in a given cluster.
     137 * - s (cxy,lid) : display all threads attached to a given core in a given cluster.
     138 * - v (cxy)     : display the calling process VMM in a given cluster.
     139 * - t (tid)     : display all owner process descriptors attached to a given TXT terminal.
     140 * - x           : force the calling process to exit.
     141 * - c           : continue calling process execution.
     142 *********************************************************************************************
     143 * @ return an integer value between 0 and RAND_MAX.
     144 ********************************************************************************************/
     145void idbg();
     146
     147
    132148#endif  // _STDLIB_H_
Note: See TracChangeset for help on using the changeset viewer.