[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Fw: [cdt-dev] Can someone explain the following launch session code in GDBCDIDebugger2 class

Hi,

It would be very much useful if someone can clear these doubts.

Thanks & Regards,
     - Nayna Jain

----- Forwarded by Nayna Jain/India/IBM on 01/06/2010 05:37 PM -----
                                                                           
             Nayna                                                         
             Jain/India/IBM@IB                                             
             MIN                                                        To 
             Sent by:                  cdt-dev@xxxxxxxxxxx                 
             cdt-dev-bounces@e                                          cc 
             clipse.org                                                    
                                                                   Subject 
                                       [cdt-dev] Can someone explain the   
             01/05/2010 04:53          following launch session code in    
             PM                        GDBCDIDebugger2 class               
                                                                           
                                                                           
             Please respond to                                             
               "CDT General                                                
             developers list."                                             
             <cdt-dev@eclipse.                                             
                   org>                                                    
                                                                           
                                                                           




Hi,

There is the following code in the method startAttachGDBSession() of
GDBCDIDebugger2 class. The me
try {
                  CLITargetAttach attach = factory.createCLITargetAttach(
pid );
                  miSession.postCommand( attach );
                  MIInfo info = attach.getMIInfo();
                  if ( info == null ) {
                        throw new MIException( MIPlugin.getResourceString(
"src.common.No_answer" ) ); //$NON-NLS-1$
                  }
                  miSession.getMIInferior().setInferiorPID( pid );
                  // @@@ for attach we nee to manually set the connected
state
                  // attach does not send the ^connected ack
                  miSession.getMIInferior().setConnected();
      }
            catch( MIException e ) {
                  throw newCoreException( MessageFormat.format(
MIPlugin.getResourceString( "src.GDBCDIDebugger2.2" ), new Integer[] { new
Integer( pid ) } ), e ); //$NON-NLS-1$
            }
            // @@@ We have to set the suspended state manually
            miSession.getMIInferior().setSuspended();
            miSession.getMIInferior().update();

Can some one explain this code ? It would be great if someone can explain
statement wise.

Moreover I observed that the code should work fine even if we comment
miSession.getMIInferior().setInferiorPID(pid);
miSession.getMIInferior().setConnected();

Similarly there is the following code for launching core debug session...
i.e...
protected void startCoreGDBSession( ILaunchConfiguration config, Session
session, IProgressMonitor monitor ) throws CoreException {
            getMISession( session ).getMIInferior().setSuspended();
            try {
                  session.getSharedLibraryManager().update();
            }
            catch( CDIException e ) {
                  throw newCoreException( e );
            }
      }


So, in startAttachGDBSession() we do miSession.getMInferior().update()..
But in startCoreGDBSession() we do
miSession.getSharedLibraryManager().update().

Can someone please explain the purpose of each of them.

Thanks & Regards,
Nayna Jain
Nexus Tools Development
Bangalore, India
Contact : 402-56859

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev