ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » strange C behaviour

Post new topic  Reply to topic
 strange C behaviour « View previous topic :: View next topic » 
Author Message
HenriqueS
PostPosted: Thu Sep 13, 2007 12:58 pm    Post subject: strange C behaviour Reply with quote

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
View user's profile Send private message
HenriqueS
PostPosted: Thu Sep 13, 2007 2:05 pm    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Thu Sep 13, 2007 2:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
David.Partridge
PostPosted: Wed Sep 19, 2007 12:06 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » strange C behaviour
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.