[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference azur::mcc

Title:DECmcc user notes file. Does not replace IPMT.
Notice:Use IPMT for problems. Newsletter location in note 6187
Moderator:TAEC::BEROUD
Created:Mon Aug 21 1989
Last Modified:Wed Jun 04 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:6497
Total number of notes:27359

1360.0. "HELP on ACC-VIO please" by STKHLM::BERGGREN (Nils Berggren EIS/Project dpmt, Sweden DTN 876-8287) Tue Aug 20 1991 12:06

Hi, 

I have a routine that sends an event to DECmcc via MCC_EVENT_PUT.

The routine creates an AES for the entity sending the event which is a child
entity, called APPLICATION, to the global entity called MYMM.

Then it creates the event-report and finally calls MCC_EVENT_PUT with 
the entity and event_report created and ofcourse the event-code,
partition and time.

If the name of the APPLICATION-entity is TEST-1 I get an access-violation 
in MCC_EVENT_PUT but if it is something else, like TEST-2, everything 
goes OK???? (funny, isn't it.. :-)  

Also if I change the id-field in the call to MCC_DESFRAME_CREATE_DESCRIPTOR 
(when creating the descriptor for the application name) the call 
to MCC_EVENT_PUT goes OK!?

Can anyone help me out on this one?  What am I doing wrong?   

Below you'll find a log from two succesive runs. Enjoy!  I don't understand
how the change from 1 to 2 can make such a difference.  Obviously there must
be something really wrong in my code, but what?

Next reply contains a program that shows the problem.


Thanks in advance
   /Nils


********************************
***** log from two runs.   *****
********************************
$ run acc_vio
Entityname [TEST-1] :TEST-1
AES-dump of entity:
        entity [0] wild = NOT_WILD class = 700 id = 1 type = 4
        instance = ..SEB075
        %X0106534542303735
        entity [1] wild = NOT_WILD class = 7000 id = 7101 type = 4
        instance = ..TEST-1
        %X0106544553542D31
ILV-dump on event-report

[  7781 ] (
    [  7782 ] (
        [  7785 ] (
            [  4711 ]             4a 55 53 54 20 41 4e 20 45 56 45 4e 54 2d 52 4
5 50 4f 52 54  -- JUST AN EVENT-REPORT
            )
        )
    )
%SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=00000008, PC
=00105A7C, PSL=03C00004
%SYSTEM-E-ACCVIO, access violation, reason mask=00, virtual address=0000000A, PC
=0000000A, PSL=00000004
$
$!
$! next round
$!
$ run acc_vio
Entityname [TEST-1] :TEST-2
AES-dump of entity:
        entity [0] wild = NOT_WILD class = 700 id = 1 type = 4
        instance = ..SEB075
        %X0106534542303735
        entity [1] wild = NOT_WILD class = 7000 id = 7101 type = 4
        instance = ..TEST-2
        %X0106544553542D32
ILV-dump on event-report

[  7781 ] (
    [  7782 ] (
        [  7785 ] (
            [  4711 ]             4a 55 53 54 20 41 4e 20 45 56 45 4e 54 2d 52 4
5 50 4f 52 54  -- JUST AN EVENT-REPORT
            )
        )
    )   ===> PUTEVENT; no event request outstanding!
T.RTitleUserPersonal
Name
DateLines
1360.1testprogram.cSTKHLM::BERGGRENNils Berggren EIS/Project dpmt, Sweden DTN 876-8287Tue Aug 20 1991 12:09213
    
     /**********************************************/
    /***** sample program to show the ACC-VIO *****/
   /**********************************************/
    
#include <mcc_interface_def.h>   /*  MCC Interface Defintions File       */
#include <mcc_descrip.h>         /*  MCC Interface Defintions File       */
#include <mcc_vea_def.h>	 /*  MCC verb, entity, attrib constants  */
#include <mcc_msg.h>		 /*  MCC message definitions file        */
#include "mcc_MYMM_am_srvc_if.H" /*  MYMM service  */ 


main()
{
    unsigned long status = MCC_S_NORMAL;

    unsigned long int  dns_status;
    unsigned long      mode	       = MCC_K_ILV_NATIVE_VALUE ;
    unsigned long int  *alloc_mem_list = MCC_K_NULL_PTR;
    unsigned short int length;
    unsigned short int eventlength     = 128;
    unsigned short int glob_name_len;
    unsigned short int appl_name_len;
    unsigned short int opaque_string_len;
    MCC_T_UNSLONG      event_partition = MCC_K_PRT_CONFIGURATION_EVENTS;
    MCC_T_UNSLONG      event_code      = MCC_K_APPL_EVENT1;   /* 7785 */
    MCC_T_UNSLONG      report_id       = 4711;
    char	       event_data[]    = "JUST AN EVENT-REPORT" ;
    char               glob_name[]     = "SEB075";
    char               appl_name[128];
    MCC_T_Descriptor   *time_stamp     = MCC_K_NULL_PTR;
    MCC_T_Descriptor   *arg_desc       = MCC_K_NULL_PTR;
    MCC_T_Descriptor   *instance       = MCC_K_NULL_PTR; 
    MCC_T_Descriptor   *appl_instance  = MCC_K_NULL_PTR; 
    MCC_T_Descriptor   *event_report   = MCC_K_NULL_PTR;
    MCC_A_AES          entity          = MCC_K_NULL_PTR;
    MCC_T_SimpleName   opaque_string;
    struct MCC_R_ILV_CONTEXT  ctx; 

    /*
    ** init mem mgmt service
    */
    status = mcc_desframe_init_alloc_list( &alloc_mem_list );

    
    memset(appl_name, 0, sizeof(appl_name) );
    printf("Entityname [TEST-1] :");
    gets( appl_name );
    if (appl_name[0] == 0)
        strcpy(appl_name, "TEST-1");

    /*
    ** create AES for gloabel entity
    */
    glob_name_len = strlen( glob_name );
    status = mcc_dns_opaque_simplename( glob_name, 
    					&glob_name_len, 
					&opaque_string,
					&opaque_string_len,
					&dns_status);

    if(status == MCC_S_NORMAL)
        status = mcc_desframe_create_descriptor( &alloc_mem_list,
						 &instance,
						 &opaque_string_len,
						 &MCC_K_DT_SIMPLE_NAME,
						 &opaque_string,
						 &MCC_K_ATTR_USERNAME,  /* 1 */
						 MCC_K_NULL_PTR);

    if(status == MCC_S_NORMAL)
	status = mcc_aes_create( &entity,
				 &MCC_K_CLASS_MYMM,  /* 700 */
				 instance,
				 &MCC_K_AES_NOT_WILD);



    /*
    ** append application entity to mymm-AES
    */
    appl_name_len = strlen(appl_name);
    status = mcc_dns_opaque_simplename( appl_name, 
    					&appl_name_len, 
					&opaque_string,
					&opaque_string_len,
					&dns_status);

    if(status == MCC_S_NORMAL)
        status = mcc_desframe_create_descriptor( &alloc_mem_list,
				&appl_instance,
				&opaque_string_len,
				&MCC_K_DT_SIMPLE_NAME,
				&opaque_string,
				&MCC_K_MYMM_SYM_APPLICATION_NAME, /* 7101 */
				MCC_K_NULL_PTR);

    if(status == MCC_S_NORMAL)
        status = mcc_aes_create(&entity,
			        &MCC_K_CLASS_APPLICATION,  /* 7000 */
 			        appl_instance,
			        &MCC_K_AES_NOT_WILD);
    


    printf("AES-dump of entity:\n");
    mcc_aes_dump(entity);

    /*
    ** create event report
    */
    if(status == MCC_S_NORMAL)
        status = mcc_desframe_create_descriptor( &alloc_mem_list,
				&event_report,
				&eventlength,
				&MCC_K_DT_ILV,
				0,
				&MCC_K_MYMM_APPL_EVENT_RECEIVED, /* 7781 */
				0);

    if(status == MCC_S_NORMAL)
        status = mcc_ilv_put_param_begin( &ctx, 
 				          event_report);
	
    if(status == MCC_S_NORMAL)
        status = mcc_ilv_put_cons_begin( &ctx,
				 &MCC_K_MYMM_APPL_EVENT_REPORT, /* 7782*/
				 MCC_K_NULL_PTR,
				 MCC_K_NULL_PTR,
				 &mode);

    if(status == MCC_S_NORMAL)
         status = mcc_ilv_put_cons_begin( &ctx,
	 				  &event_code,
					  MCC_K_NULL_PTR,
					  MCC_K_NULL_PTR,
					  &mode);

    /*
    ** create descriptor for event_data
    ** and insert it into event_report
    */
    length = strlen(event_data);
    if(status == MCC_S_NORMAL)
        status = mcc_desframe_create_descriptor(
				&alloc_mem_list,  /*  Memory Allocation List */
				&arg_desc, 	  /*  Descriptor Pointer     */
				&length,	  /*  Length                 */
				&MCC_K_DT_LATIN1STRING,	/*  Datatype	     */
				&event_data,		/*  Initial Value    */
				&report_id,		/*  Id		     */
				&DSC_K_DTYPE_T);	/*  VMS datatype     */

    
    if(status == MCC_S_NORMAL)
        status = mcc_ilv_put(   &ctx, 
				arg_desc, 
				MCC_K_NULL_PTR );

    if(status == MCC_S_NORMAL)
         status = mcc_ilv_put_cons_end( &ctx ); 
 
    /* End Constructor */
    if(status == MCC_S_NORMAL)
	status = mcc_ilv_put_cons_end( &ctx );

    /* End building attr Output */
    if(status == MCC_S_NORMAL)
	status = mcc_ilv_put_param_end( &ctx, 
					event_report );

    /*
    ** create timestamp with current time
    */
    if(status == MCC_S_NORMAL)
        status = mcc_time_create(&time_stamp,
	                         &MCC_K_DT_LATIN1STRING,
				 0, 0);
    if(status == MCC_S_NORMAL)
        status = mcc_time_get_current(time_stamp);
    
    /*
    ** dump event-data
    */
    printf("ILV-dump on event-report\n");
    if(status == MCC_S_NORMAL)
        mcc_ilv_dump( event_report );


    /*
    ** deliver event...
    */
    if(status == MCC_S_NORMAL)
        status = mcc_event_put( entity,
				&event_partition,
				&event_code,
				event_report,
				time_stamp);


    if (status == MCC_S_NORMAL)
        printf ("   ===> PUTEVENT; Successful completion!\n");
    else if (status == MCC_S_NOEVENTREQ)
        printf ("   ===> PUTEVENT; no event request outstanding!\n");
    else  
        printf ("   ===> PUTEVENT; error!  status = %d\n", status);

    return( status );
    
} /* send_report_to_mcc */



1360.2Only thing I could find - was incorrect datatype for the Event TimestampNANOVX::ROBERTSKeith Roberts - DECmcc Toolkit TeamTue Aug 20 1991 17:5729
Only thing I could find - was incorrect datatype for the Event Timestamp...
You put in MCC_K_DT_LATIN1STRING .. but it should be MCC_K_DT_BIN_ABS_TIM.

Now - I don't know if that is the problem, but I can't see why it would be.

Also, the SRM says (for the 'mcc_time_get_current' routine:

  "A condition value of MCC_S_UNSUPP_OP is returned if the caller passed
   in a descriptor with a time data type of anything other than
   MCC_K_DT_BIN_ABS_TIM."

Your code properly tests for a 'normal' status after calling the mcc_time_create
routine - I would have expected you to get the UNSUPP_OP error status (?)

--------- Unsolicited Info: ON

btw -- I don't know if you intend on making this portable code (to Ultrix), but
just in case ... You cannot pass a constant by reference.  You must set
a variable to the constant value, then pass the variable by reference.

   MCC_T_Unsigned32  time_datatype = MCC_K_DT_BIN_ABS_TIM;
    :
    :
   status = mcc_time_create( &time_stamp, &time_datatype, 0, 0 )

--------- Unsolicited Info: OFF


/keith
1360.3logical name for LOG and TRACE ?STKHLM::BERGGRENNils Berggren EIS/Project dpmt, Sweden DTN 876-8287Tue Aug 20 1991 18:5418
    repl .2
    
>>> You put in MCC_K_DT_LATIN1STRING .. but it should be MCC_K_DT_BIN_ABS_TIM.
    
    Thanks for the remark. I'll change the code.
    
>>> btw -- I don't know if you intend on making this portable code (to Ultrix), but
>>> just in case ... You cannot pass a constant by reference.  You must set
>>> a variable to the constant value, then pass the variable by reference.
    
    No, we don't have any plans on porting the code but we really hope to
    get things to work with our event-sink.  
    
    What was the name of the logicals to enable tracing on the event-mgr,
    and what values to use?  I'll see if I can get something out of the
    trace.
    
    /Nils
1360.4event_mgr trace-logSTKHLM::BERGGRENNils Berggren EIS/Project dpmt, Sweden DTN 876-8287Wed Aug 21 1991 08:5795
1360.5How are you compiling/linking? /debug?TOOK::GUERTINDon't fight fire with flamesWed Aug 21 1991 13:395
    I've just tried to run your program and it ACCVIOed in
    mcc_aes_create(), it never even got close to calling mcc_event_put().
    
    -Matt.
    
1360.6how I compile/link/debugSTKHLM::BERGGRENNils Berggren EIS/Project dpmt, Sweden DTN 876-8287Wed Aug 21 1991 15:20106
1360.7more infoSTKHLM::BERGGRENNils Berggren EIS/Project dpmt, Sweden DTN 876-8287Wed Aug 21 1991 15:2459
More info again.

When I get the acc_vio (I have done SET BREAK/EXCEPTION)
the call stack is as follows:

 module name     routine name                     line       rel PC    abs PC
*MCC_EVENT_ERB   ERB_MATCH_ERB                    2021      00000050  00105A7C
*MCC_EVENT_PRB   PRB_MATCH_PRB                    1956      000000A7  00105383
*MCC_EVENT_CIT   ESS$_MATCH_SUBSCRIPTION          4003      0000012E  0010240A
*MCC_EVENT_PUT   mcc_event_put                    2576      00000391  000C55C1
*SHARE$ACC_VIO   MAIN                                       00000251  00000A6D
*SHARE$ACC_VIO   MCC_DESFRAME_VALIDATE_CALLARGS             0000149F  000027A7
*SHARE$ACC_VIO   MCC_DESFRAME_VALIDATE_CALLARGS             000014EA  000027F2
*SHARE$ACC_VIO   MCC_DESFRAME_VALIDATE_CALLARGS             0000147A  00002782

Looking at the instructions for ERB_MATCH_ERB they are as follows: 
(only first 25 lines)

Line  1977: entry mask ^M<R2,R3,R4,R5>
          : MOVAB    B^-104(SP),SP
          : MOVAB    L^1433268,R4
Line  2007: CLRL     B^-12(FP)
Line  2010: PUSHAL   B^-8(FP)
          : PUSHL    B^12(AP)
          : CALLS    S^#2,L^MCC_AHS\mcc_ahs_get_state
          : MOVL     R0,R5
Line  2011: MCOML    R5,R2
          : BICL3    R2,I^#1,R2
          : BNEQ     MCC_EVENT_ERB\ERB_MATCH_ERB\%LINE 2018
Line  2013: PUSHAL   B^123(R4)
          : CALLS    S^#1,L^MCC_EVENT_DUMP\evt__printf
Line  2014: PUSHL    R5
          : CALLS    S^#1,L^MCC_EVENT_DUMP\evt__putmsg
Line  2015: MOVL     R5,R0
          : RET
Line  2018: TSTL     B^-8(FP)
          : BEQL     MCC_EVENT_ERB\ERB_MATCH_ERB\%LINE 2020
          : BRW      MCC_EVENT_ERB\ERB_MATCH_ERB\%LINE 2073
Line  2020: MOVL     B^4(AP),R3
Line  2021: TSTL     B^8(R3)
          : BNEQ     MCC_EVENT_ERB\ERB_MATCH_ERB\%LINE 2031
Line  2023: PUSHAL   B^-12(FP)
  :
  :
  :
I not an expert on assembler but I manage to read some.

Line 2021 is the one that crashes.  We're moving the first argument, B^4(AP), 
to R3 and then trying to access the second longword of what R3 is pointing at.
The problem is that the first argument is NULL which gives the acc-vio on
address=00000008.  All my arguemnts to MCC_EVENT_PUT are non-zero and as 
far as I know, they're correct, but one never knows...

Now, can anyone who has the sources look and see what we're trying to 
access, and why we're getting this acc-vio  
    (please....)

   /Nils
1360.8Are you calling mcc_event_get()?TOOK::GUERTINDon't fight fire with flamesWed Aug 21 1991 15:405
    This sounds like what happens when someone calls mcc_event_get() with
    an event code of zero in the first argument.  What does your
    mcc_event_get() call look like?
    
    -Matt.
1360.9did you apply the patch in 1267.2?TOOK::GUERTINDon't fight fire with flamesWed Aug 21 1991 15:431
    
1360.10no event_get-call!STKHLM::BERGGRENNils Berggren EIS/Project dpmt, Sweden DTN 876-8287Wed Aug 21 1991 16:414
    repl .8
    there's no event_get call done, which means that I should get
    the return-code for "no event requests outstanding" from mcc_event_put.
    
1360.11patch applied soon....STKHLM::BERGGRENNils Berggren EIS/Project dpmt, Sweden DTN 876-8287Wed Aug 21 1991 16:446
    repl .9
    
    nope, I missed that one.  I'll do now, and post the results.
    
       Thanks!
    
1360.12Everything works fine for me, now.TOOK::GUERTINDon't fight fire with flamesWed Aug 21 1991 16:595
    I just realized that I forgot mcc_kernel_init.obj.  After linking with
    it, I get no errors.  Check if you have ANY processes still running on
    the system using MCC, and exit them before testing.
    
    -Matt.
1360.13everything works fine for me too, nowSTKHLM::BERGGRENNils Berggren EIS/Project dpmt, Sweden DTN 876-8287Mon Aug 26 1991 18:439
    I tried to apply the patch but got the acc-vio anyway.  
    
    Then, after going crazy for a while, I reinstalled MCCBMS and applied
    the kernel-patch as well as the alarms-patch.  Also I reregistered my
    AM and now everything works fine.
    
    No problems any more...
    
       /Nils