Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-debug-dev] Picl code changes

Samantha,

I made some changes to Picl code in my sandbox. I
tested it on my AIX machine, it works. All the changes
are based on Level cdt-eclipse-20020116, Here are the
changes:

GdbDebugSession.java.diff:
=========================
840c840,841
<                   +"
moduleInfo[i].segments.size()="+moduleInfo[i].segments.size()+"
fullFileName="+moduleInfo[i].fullFileName);
---
>                   +"
start="+moduleInfo[i].startAddress+"
end="+moduleInfo[i].endAddress
>                   +"
fullFileName="+moduleInfo[i].fullFileName );
842c843
<           
_moduleManager.setModuleStartFinishAddress(moduleInfo[i].name,
moduleInfo[i].segments);
---
>           
_moduleManager.setModuleStartFinishAddress(moduleInfo[i].name,
moduleInfo[i].startAddress, moduleInfo[i].endAddress);


ModuleManager.java.diff:
========================
968c968
<    public void setModuleStartFinishAddress(String
moduleName, Vector segments)
---
>    public void setModuleStartFinishAddress(String
moduleName, String start, String finish)
971c971
<       setModuleStartFinishAddress(moduleID,
segments);
---
>       setModuleStartFinishAddress(moduleID, start,
finish);
976c976
<    private void setModuleStartFinishAddress(int
moduleID, Vector segments)
---
>    private void setModuleStartFinishAddress(int
moduleID, String start, String finish)
979c979
<          
Gdb.traceLogger.dbg(2,"ModuleManager.setModuleStartFinishAddress
moduleID="+moduleID+" with segments
size="+segments.size() );
---
>          
Gdb.traceLogger.dbg(2,"ModuleManager.setModuleStartFinishAddress
moduleID="+moduleID+" start="+start+"finish="+finish
);
983c983
<       module.setModuleSegment(segments);
---
>       module.setModuleStartFinishAddress(start,
finish);



GetGdbSharedLibraries.java.diff:
===============================
11,12d10
< import  com.ibm.debug.gdbPicl.objects.ModuleSegment;
< import  java.util.*;
23c21,22
<      public Vector segments = new Vector(0);
---
>      public String startAddress = null;
>      public String endAddress = null;
59d57
<      String start = "-1", end = "-1", startData
="-1", endData = "-1";
64d61
< /* This will remove the last entry from the list
generated by "info sharedlibrary"
67d63
< */
72,73c68
<         {  
<          if(
!lines[i].startsWith(_gdbProcess.MARKER))
---
>         {  if(
!lines[i].startsWith(_gdbProcess.MARKER))
120,123d114
<              
<              String keyword = " "; // default to
space
<              if
(System.getProperty("os.name").equals("AIX"))
<               keyword = "-";
125,126c116,117
<                int index = str.indexOf(keyword);
<                if(index<=0)
---
>                int space = str.indexOf(" ");
>                if(space<=0)
131,132c122,123
<                start = str.substring(0,index);
<                str = str.substring(index+1);
---
>                String start =
str.substring(0,space);
>                str = str.substring(space+1);
140,141d130
<              if
(System.getProperty("os.name").equals("AIX"))
<               keyword = "\t";
143,144c132,133
<                index = str.indexOf(keyword);
<                if(index<=0)
---
>                space = str.indexOf(" ");
>                if(space<=0)
149,183c138,141
<                end = str.substring(0,index);
<             
if(System.getProperty("os.name").equals("AIX")) { 
<                str = str.substring(index+1);
<                keyword = "-";
<                  index = str.indexOf(keyword);
<                  if(index>0) {  // data segment?
<                               x = str.indexOf("0x");
<                       if(x<0) {
<                               if
(Gdb.traceLogger.ERR) 
<                                          
Gdb.traceLogger.err(1,"GetGdbSharedLibraries.getSharedLibraries
missing '0x' startDataAddress in str="+str );
<                               continue;
<                       }
<                       startData =
str.substring(x,index);
<                       str = str.substring(index+1);
<                               x = str.indexOf("0x");
<                               if(x<0) {
<                               if
(Gdb.traceLogger.ERR) 
<                                          
Gdb.traceLogger.err(1,"GetGdbSharedLibraries.getSharedLibraries
missing '0x' endData in str="+str );
<                               continue;
<                               }
<                               index =
str.indexOf("\t");
<                               if(index<=0) {
<                               if
(Gdb.traceLogger.ERR) 
<                                          
Gdb.traceLogger.err(2,"GetGdbSharedLibraries.getSharedLibraries
missing '\t' after startData in str="+str );
<                               continue;
<                               }
<                               endData =
str.substring(0,index);
<                  } // data segment
<              } // for AIX
<              
<                str = str.substring(index+1);
<              keyword = " "; // default to space
<              if
(System.getProperty("os.name").equals("AIX"))
<               keyword = "\t";
<                x = str.lastIndexOf(keyword);
---
>                String end = str.substring(0,space);
>                str = str.substring(space+1);
> 
>                x = str.lastIndexOf(" ");
189a148
>                String moduleName = str;
192,200c151
<             
if(System.getProperty("os.name").equals("AIX")) {
<                 int p= str.indexOf(")");
<                 if(p > 0)
<                               objPath =
str.substring(p+2,slash+1);
<                 else
<                       objPath = str.substring(0,
slash+1);
<              }
<              else
<               objPath = str.substring(0,slash+1);
---
>                objPath = str.substring(0,slash+1);
202,206c153
<             
if(System.getProperty("os.name").equals("AIX")) {
<                  fullObjFileName =
lines[i].substring(0);
<              }
<              else
<                    fullObjFileName =
objPath+objFile;
---
>                fullObjFileName = objPath+objFile;
242,243c189,190
<             
_moduleInfo[indx].segments.addElement(new
ModuleSegment(start, end));  
<             
_moduleInfo[indx].segments.addElement(new
ModuleSegment(startData, endData));  
---
>                _moduleInfo[indx].startAddress =
start;
>                _moduleInfo[indx].endAddress = end;
254a202
> 


GetGdbModuleParts.java.diff:
===========================
16,17c16
< import  com.ibm.debug.gdbPicl.objects.ModuleSegment;
< import  java.util.*;
---
> 
28,30d26
<    Vector segments = new Vector(0);
< 
< 
100,101c96,99
<                  int x = str.indexOf("0x");
<                  if(x>0)
---
>                  if(startAddress.equals(""))
>                  {
>                     int x = str.indexOf("0x");
>                     if(x>0)
102a101
>                  }
108c107
<                        x = str.indexOf("0x");
---
>                        int x = str.indexOf("0x");
122,133c121,128
<                  if(startAddress.equals("") ||
endAddress.equals(""))
<                  {
<                    if (Gdb.traceLogger.ERR)
<                     
Gdb.traceLogger.err(2,"GetGdbModuleParts.getMainModule
could not locate main module information, missing:
startAddress or endAddress from str="+str );
<                    return false;
<                  }
<                   segments.addElement(new
ModuleSegment(startAddress, endAddress));
<                   if (Gdb.traceLogger.EVT)
<                  
Gdb.traceLogger.evt(1,"<<<<<<<<========
GetGdbModuleParts.getMainModule name="+shortName
<                       +" start="+startAddress+"
end="+endAddress+" fullFileName="+fullName );
<                str = lines[i++];
<              } // while loop
---
>                  str = lines[i++];
>               }
>               if(endAddress.equals(""))
>               {
>                  if (Gdb.traceLogger.ERR)
>                     
Gdb.traceLogger.err(2,"GetGdbModuleParts.getMainModule
could not locate main module information, missing:
"+"endAddress from str="+str );
>                  return false;
>               }
138c133,136
<            
_moduleManager.setModuleStartFinishAddress(shortName,
segments);
---
>               if (Gdb.traceLogger.EVT)
>                  
Gdb.traceLogger.evt(1,"<<<<<<<<========
GetGdbModuleParts.getMainModule name="+shortName
>                       +" start="+startAddress+"
end="+endAddress+" fullFileName="+fullName );
>              
_moduleManager.setModuleStartFinishAddress(shortName,startAddress,endAddress);
141c139
<                  
Gdb.traceLogger.evt(2,"GetGdbModuleParts.getMainModule
moduleID="+_debugSession.getCurrentModuleID()+"
shortName="+shortName+" fullName=" +fullName);
---
>                  
Gdb.traceLogger.evt(2,"GetGdbModuleParts.getMainModule
moduleID="+_debugSession.getCurrentModuleID()+"
shortName="+shortName+" fullName=" +fullName+"
startAddress="+startAddress+" endAddress="+endAddress
);
536,541d533
<                 else
<                  if(colon>0) // AIX: Object file
shr.o: Objfile at 0xXXXXXXXX, bfd at 0xXXXXXXXX, XX
minsyms
<                  {  int x = str.indexOf(keyword);
<                     objFile =
str.substring(x+keyword.length(),colon);
<                  } 
< 
543,544c535
<                 if(slash>0)
<                       objPath =
str.substring(keyword.length(),slash+1);
---
>                   objPath =
str.substring(keyword.length(),slash+1);


Module.java.diff:
================
8d7
< import  java.math.*;
26,27d24
<    Vector _segments = new Vector(0);
< 
34c31
<       _segments = new Vector(0);
---
> 
44d40
< 
66,67c62
< 
<    public void setModuleSegment(Vector segs)
---
>    public void setModuleStartFinishAddress(String
start, String finish)
69,73c64,79
<        _segments = segs;
<    
< 
<        if (Gdb.traceLogger.DBG) 
<              
Gdb.traceLogger.dbg(1,"Module.setModuleSegment
size="+_segments.size()); 
---
>        start = start.substring(2);
>        finish = finish.substring(2);
>        _startAddress = -1;
>        _finishAddress = -1;
>        try
>        {
>           _startAddress =
Integer.parseInt(start,16);
>           _finishAddress =
Integer.parseInt(finish,16);
>           _startAddressHex = "0x"+start;
>           _finishAddressHex = "0x"+finish;
>        }
>        catch(java.lang.NumberFormatException exc)
>        {
>           if (Gdb.traceLogger.DBG) 
>              
Gdb.traceLogger.dbg(1,"Module.setModuleStartFinishAddress
NUMBER_EXCEPTION start="+start+" finish="+finish);
>        }
75,76c81,82
<           
Gdb.traceLogger.evt(3,"Module.setModuleSegment with
segment size="+_segments.size());
<    } 
---
>           
Gdb.traceLogger.evt(3,"Module.setModuleStartFinishAddress
start="+Integer.toHexString(_startAddress)+"
finish="+Integer.toHexString(_finishAddress) );
>    }
81d86
< 
86,99c91
<        BigInteger addr = new BigInteger("-1", 16);
<        BigInteger start = new BigInteger("-1", 16);
<        BigInteger end = new BigInteger("-1", 16);
<        ModuleSegment seg; 
<        String startAddress, endAddress;
<        int i;
< 
<        if (Gdb.traceLogger.DBG) {
<             Gdb.traceLogger.dbg(3,"Entering
Module.containsAddress targetAddress="+address );
<             for(i = 0; i<_segments.size(); i++) {
<               seg =
(ModuleSegment)_segments.elementAt(i);
<              
Gdb.traceLogger.dbg(2,"Module.containsAddress:seg["+i+"].startAddress="+seg.startAddress+"
seg["+i+"].endAddress="+seg.endAddress);
<           }
<        }
---
>        int i = -1;
102,115c94,98
<           addr = new BigInteger(address,16);
<         for(i = 0; i < _segments.size(); i++) {
<           seg =
(ModuleSegment)_segments.elementAt(i);
<           startAddress =
seg.startAddress.substring(2);
<           endAddress = seg.endAddress.substring(2);
<           if(startAddress.length()>0 &&
endAddress.length()>0) {
<               start = new BigInteger(startAddress,
16);
<               end = new BigInteger(endAddress, 16);
<           }
<           if(addr.compareTo(start)>=0 &&
addr.compareTo(end)<=0){
<               contained = true;
<               break;
<           }
<         } 
---
>           i = Integer.parseInt(address,16);
>           if (_startAddress<0 || _finishAddress<0)
>              contained = false;
>           else if (i>_startAddress &
i<_finishAddress)
>              contained = true;
123,124c106
<       Gdb.traceLogger.dbg(2,"Module.containsAddress
targetAddress="+address +" CONTAINED="+contained+"\n"
);
<        
---
>           
Gdb.traceLogger.dbg(2,"Module.containsAddress
targetAddress="+address +" CONTAINED="+contained+"
moduleStart=0x"+Integer.toHexString(_startAddress) +"
moduleFinish=0x"+Integer.toHexString(_finishAddress)
);
233a216,221
>    private int _startAddress = -1;
>    private int _finishAddress = -1;
>    private String _startAddressHex = "0x????????";
>    private String _finishAddressHex = "0x????????";
>    public String getStartAddressHex()   {  return
_startAddressHex; }
>    public String getFinishAddressHex()   {  return
_finishAddressHex; }
251d238
< 




New file in objects:  ModuleSegment.java
=======================================
/*
 * Copyright (c) 1995, 2001 International Business
Machines Corporation. All rights reserved.
 * This program and the accompanying materials are
made available under the terms of
 * the Common Public License which accompanies this
distribution.
 */

package com.ibm.debug.gdbPicl.objects;
import  com.ibm.debug.gdbPicl.*;

import com.ibm.debug.epdc.*;
import java.util.*;
import java.text.*;

/**
 * ModuleSegment.
 */
public class ModuleSegment
{
   public ModuleSegment(String s, String e)
   {
     startAddress = s;
     endAddress = e; 
   }
  //Data members
  String startAddress = "-1";
  String endAddress = "-1";

}




BTW, in my sandbox I commented "remove tailing ..."
code out. It is not necessary to 
check "(gdb)", since the input to this function will
never have this "(gdb)" thing. 

For storing address ranges of modules, 
Instead of using interal classes, I created
ModuleSegment.class in objects dir, since this 
information is needed in several places.
  
Regards, 

Linda


__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com


Back to the top