[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-dev] Modules view is not displaying properly on HP-UX.
|
Hi,
Modules view is not displaying properly while debugging on HP-UX. The
root causes are
1) The format of shared library information provided by HP-UX gdb is
different from gdb on Windows/Linux
2) On Windows/Linux, the shared library information has one line entry
for each library. But on HP-UX, for each library, there is a two line
entry.
eg.
Result of "info sharedlibrary" command on Windows
--------------------------------------------------
DLL Name Load Address
ntdll.dll 77f51000
/cygdrive/c/WINNT/system32/kernel32.dll 77e61000
/usr/bin/cygwin1.dll 61001000
/cygdrive/c/WINNT/system32/advapi32.dll 77dd1000
/cygdrive/c/WINNT/system32/rpcrt4.dll 78001000
/cygdrive/c/WINNT/System32/secur32.dll 76f91000
/cygdrive/c/WINNT/system32/user32.dll 77d41000
/cygdrive/c/WINNT/system32/gdi32.dll 7f001000
Result of "info sharedlibrary" on HP-UX
---------------------------------------
Shared Object Libraries
tstart tend dstart dend
/usr/lib/hpux32/dld.so
0x200000007ef80000 0x200000007effa130 0x200000007ef79000
0x200000007ef7f748
/usr/lib/hpux32/libstd_v2.so.1
0x200000007ede1000 0x200000007ef76bf0 0x200000007edd0000
0x200000007edddd78
/usr/lib/hpux32/libCsup.so.1
0x200000007ed83000 0x200000007edcbee0 0x200000007ed7c000
0x200000007ed82ce8
/usr/lib/hpux32/libm.so.1
0x200000007ec19000 0x200000007ed7b4f0 0x200000007ec15000
0x200000007ec18818
/usr/lib/hpux32/libunwind.so.1
0x200000007ebcb000 0x200000007ec14800 0x200000007ebc9000
0x200000007ebca2e0
/usr/lib/hpux32/libc.so.1
0x200000007e94b000 0x200000007ebc8200 0x200000007e938000
0x200000007e9490f8
/usr/lib/hpux32/libdl.so.1
0x200000007e932000 0x200000007e9351f0 0x200000007edde000
0x200000007edde080
/usr/lib/hpux32/libuca.so.1
0x200000007e928000 0x200000007e92faf0 0x200000007e94a000
0x200000007e94a150
To make Modules view to work, I have added a method called
'parseHPUXShared()'
to parse gdb output according to HP_UX format.
I have also inserted a code segment for merging two lines into a single
line entry and calling parseHPUXShared() method if the header starts
with "Shared Object Libraries" at parseShared(). I have listed both code
below
void parseShared(String str, List aList)
{
if (!hasProcessHeader) {
// Process the header and choose a type.
if (str.startsWith("DLL")) { //$NON-NLS-1$
isUnixFormat = false;
}
// FIX : HP-UX shared library view
else if(str.startsWith("Shared Object
Libraries"))
{
// it is hpux format
isHPUXFormat = true;
}
//end fix
hasProcessHeader = true;
}
// FIX : HP-UX shared library view
else if (isHPUXFormat)
{
if(str.startsWith("0x"))
{
//merging...
mergestr +=" "+str;
parseHPUXShared(mergestr, aList);
return;
}
else if(str.startsWith("tstart"))
{
return;
}
else
{
// new shareed library entry...;
mergestr = new String(str);
return;
}
}
// end FIX
else if (isUnixFormat) {
parseUnixShared(str, aList);
} else {
parseWinShared(str, aList);
}
}
// FIX : HP-UX shared library view
void parseHPUXShared(String str, List aList) {
if (str.length() > 0) {
// Pass the header
int index = -1;
String from = ""; //$NON-NLS-1$
String to = ""; //$NON-NLS-1$
boolean syms = false;
String name = ""; //$NON-NLS-1$
for (int i = 0;(index = str.indexOf(' ')) != -1
|| i < 3; i++)
{
if (index == -1) {
index = 0;
}
String sub =
str.substring(0,index).trim();
str= str.substring(index).trim();
switch (i) {
case 0 :
name = sub;
break;
case 2 : // second column is
"To"
to = sub;
break;
case 1 : // first column is
"From"
from = sub;
break;
}
}
syms=true;
if (name.length() > 0) {
MIShared s = new MIShared(from, to,
syms, name);
aList.add(s);
}
}
} // end of fix
Can you please look at this problem ? I also filed a bug. Please see bug
#95705
Thanks,
JP