Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-debug-dev] problems: remote debug on AIX

Hi,

1.  For the first problem, I agree that a guard needs to be put in to make
sure that "slash" has a valid value before performing a substring
operation.

As you proposed, the code should look like the following:

int slash=str.lastIndexOf("/");
if(colon>0 && slash>0)
{
  objFile=str.substring(slash+1, colon);
}
fullObjFileName=str.substring(keyword.length(),colon).trim();

if (slash > 0)              <==== adding this line
     objPath = str.substring(keyword.length(),slash+1);

2)  For the second problem, I couldn't find the function
GetGdbSharedLibraries.getSharedLibraries
in the code.  Did you mean function
GetGdbSharedLibraries.updateSharedLibraries?

Are you looking at the following codes:

For line 120:

int space = str.indexOf(" ");
if(space<=0)
{  if (Gdb.traceLogger.ERR)
       Gdb.traceLogger.err(2,"GetGdbSharedLibraries.getSharedLibraries
missing ' ' after startAddress in str="+str );
       continue;      <----------- this is line 120 for me
}

For line 140:

space = str.indexOf(" ");
if(space<=0)
{  if (Gdb.traceLogger.ERR)
       Gdb.traceLogger.err(2,"GetGdbSharedLibraries.getSharedLibraries
missing ' ' after startAddress in str="+str );
    continue;
}
String end = str.substring(0,space);
str = str.substring(space+1);   <--------- this is line 140 for me

I don't think "#ifdef AIX" statements work for Java.

Since you are running gdbPicl on AIX, I believe there will be more places
like this where you will need to make adjustments.  One way of doing it is
to create a member variable in GdbDebugSession.  This member variable
should store information regarding what platform the engine is running on.
And then you can initialize this member variable using the following
statment:

Assuming the new member variable from GdbDebugSession is named as
_osName...

_osName = System.getProperties().getProperty("os.name");

You can also create getter and setting for this member variable in
GdbDebugSession.

You can check for platform information in other places in the code and set
keywords to different values like the following:

String keyword = " ";  // default to space
if (_debugSession.getOSName().equals("AIX"))
     keyword = "-";

int space = str.indexOf(keyword);

Since most classes in gdbPicl have access to GdbDebugSession and this class
is used for storing global data used for the entire debug session, putting
os info data in that class will allow you to query os info at different
places easily.


3.  For the third problem, gdb on AIX is returning addresses greater than
what an integer can represent.  I don't think string comparisons will work
in this case.  A module means a static library, a dll or an executable.
When gdbPicl generates call stack information, the frame address from the
call stack is passed to this containsAddress function to determine which
module a file from the call stack is coming from.  If the frame address is
within the limit of a module's start and end address, then the module's id
will be returned.  And we can associate the corresponding file from the
call stack with the correct module.  To solve your problem, you can replace
integer with long.  Here's what you can do:
     long address = Long.parseLong(start, 16);

4.  As mentioned previously, a module's start and end address are used to
associate a file with the correct module based on a frame address from the
call stack.  As for the _dataAddres, I am not sure what it is for at the
moment.  I will try to find out and let you know.

Samantha Chan



Back to the top