Bug 95705 - Modules view is not displaying properly on HP-UX.
Summary: Modules view is not displaying properly on HP-UX.
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-cdi-gdb (show other bugs)
Version: 3.0   Edit
Hardware: PC HP-UX
: P3 normal (vote)
Target Milestone: 3.0   Edit
Assignee: Alain Magloire CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2005-05-18 02:01 EDT by JP CLA
Modified: 2009-01-09 14:17 EST (History)
3 users (show)

See Also:


Attachments
Patch to diplay modules view properly on HP-UX. (2.67 KB, patch)
2005-05-18 02:04 EDT, JP CLA
bjorn.freeman-benson: iplog+
Details | Diff
License Text (795 bytes, patch)
2005-05-25 13:23 EDT, Balasubramaniyan K CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description JP CLA 2005-05-18 02:01:12 EDT
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 have also attached my patch.

Thanks,
JP
Comment 1 JP CLA 2005-05-18 02:04:47 EDT
Created attachment 21311 [details]
Patch to diplay modules view properly on HP-UX.

Code sengment has been added in the MIInfoSharedLibraryInfo.java to display
Modules view properly on HP-UX. Please see the patch.
Comment 2 JP CLA 2005-05-23 01:33:42 EDT
Can you please look at this problem?

Thanks,
JP
Comment 3 JP CLA 2005-05-25 03:50:22 EDT
Is there any other solution for this problem?

Thanks,
JP
Comment 4 Alain Magloire CLA 2005-05-25 11:39:33 EDT
(In reply to comment #2)
> Can you please look at this problem?
> 

Ok, Patch apply to 3.0(head branch).

Thanks.
Please verify when you have the chance
Comment 5 Balasubramaniyan K CLA 2005-05-25 13:23:23 EDT
Created attachment 21745 [details]
License Text

Hi Alain, could you apply this patch also. This has the Copyright text which is
necessary as per the Legal team of the HP. We forgot to put these text in the
previous submission.

Thanks,
Bala