|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
strange C behaviour |
« View previous topic :: View next topic » |
Author |
Message
|
HenriqueS |
Posted: Thu Sep 13, 2007 12:58 pm Post subject: strange C behaviour |
|
|
 Master
Joined: 22 Sep 2006 Posts: 235
|
Sorry to "bug" about C programming here, but debuging a mq exit is a damn task to do since you cannot do step-by-step debugging...
any good explanation why this does not run?
Code: |
//setting a message user id...
MQCHAR12 userid;
memset (userid, '\0', 12);
strcpy(userid, "USER");
strncpy(pMQXQH->MsgDesc.UserIdentifier, userid, 12); //crashes here
|
I tried replacing "12" with:
a) "sizeof(pMQXQH->MsgDesc.UserIdentifier)"
b) MQ_USER_ID_LENGTH
And it still crashes...strange enough I´ve got an example in the net almost equal:
Code: |
MQCHAR12 MyMQMD_UserIdentifier ;
memset ( MyMQMD_UserIdentifier, '\0', sizeof(MyMQMD_UserIdentifier) ) ;
strncpy ( MyMQMD_UserIdentifier, pMsgData, LngMsg2Delete ) ;
strncpy ( pMQXQHptr -> MsgDesc.UserIdentifier,
MyMQMD_UserIdentifier,
sizeof(pMQXQHptr -> MsgDesc.UserIdentifier) ) ;
|
Any idea? Actualy in the very beginning my code was simple as
Code: |
strncpy(pMQXQH->MsgDesc.UserIdentifier, "USERxxxxxxxx", 12); but it chrashed also (x=spaces).
|
_________________ HenriqueS
Certified Websphere MQ 6.0 System Administrator |
|
Back to top |
|
 |
HenriqueS |
Posted: Thu Sep 13, 2007 2:05 pm Post subject: |
|
|
 Master
Joined: 22 Sep 2006 Posts: 235
|
Forget about it folks, there was no message flowing in the channel and the function was being called anyway with invalid data on the pMQXQH structure... _________________ HenriqueS
Certified Websphere MQ 6.0 System Administrator |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Sep 13, 2007 2:08 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
HenriqueS wrote: |
Forget about it folks, there was no message flowing in the channel and the function was being called anyway with invalid data on the pMQXQH structure... |
Exits are an advanced topic for a reason.. I know I've never been brave enough to try to write one.
It probably wasn't "invalid" data.
It might be "undocumented" data...  _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
David.Partridge |
Posted: Wed Sep 19, 2007 12:06 am Post subject: |
|
|
 Master
Joined: 28 Jun 2001 Posts: 249
|
You say you can't use a debugger on MQ exits - actually you can - at least under Windows using JIT debugging.
You put typically a divide by zero at the entry point of the exit (using a static variable to hold the zero). When you hit the divide by zero, VC++ gets control, and you change the static variable to be none zero), set your breakpoints and off you go.
I've heard suggestions that it's also possible to get VC++ to set up breakpoints on a DLL that WILL be loaded in the future, but never worked out how to get that working.
Dave |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|