This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 183671 - corrupted corefile generated by IDE run
Summary: corrupted corefile generated by IDE run
Status: RESOLVED INCOMPLETE
Alias: None
Product: cnd
Classification: Unclassified
Component: execution (show other bugs)
Version: 6.x
Hardware: Other Linux
: P4 normal (vote)
Assignee: Andrew Krasny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-07 19:10 UTC by Chihin Ko
Modified: 2010-04-10 19:27 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chihin Ko 2010-04-07 19:10:29 UTC
Originally filed as CR 6940822

corefile was corrupted if generated by sunstudio IDE run command, 
compare following 2 scenarios A and B.

----------------------------------------------------------------------------
Scenario A

RedHat 5.3 (sqao75)
Scenario:
- Create Fractal project in default directory (/home/vs157455/SunStudioProjects/Fractal_1)
- Switch off "Profile|Show profiling indicators during run" property in "Project Properties" window
- Add such code into main():
 int *p=NULL;
 *p=5;
- Run project
==> run failed. core dumped.
- Open Files tab, select "core" file and call context menu. Select "Debug Core File..."
- Press Debug button in "Debug Core File" window
==> "Unable to extract program name from the core file." window appears



directly use dbx to load corefile generated by IDE run :

> rlogin sqao75
> cd /export/home/sstrunk-tester/SunStudioProjects/Fractal_1
sqao75 50> /shared/dp/sstrunk/build22.0/inst/intel-Linux/bin/dbx - core.bad
dbx: warning: pathname might be truncated in <core>: /export/home/sstrunk-tester/SunStudioProjects/Fractal_1/dist/Debug/OracleSolari
Corefile specified executable: "/export/home/sstrunk-tester/SunStudioProjects/Fractal_1/dist/Debug/OracleSolari"
dbx: warning: Cannot open executable. -- No such file or directory

dbx: Unable to extract program name from <core>. See `help core' for more info.

-------------------------------------------------------------------------------
Scenario B :

corefile generated from directly invoking  fractal_1
was successfully loaded by dbx :

> rlogin sqao75
> cd /export/home/sstrunk-tester/SunStudioProjects/Fractal_1
> dist/Debug/OracleSolarisStudio-Linux-x86/fractal_1  <== generate corefile from command line
sqao75 47> /shared/dp/sstrunk/build22.0/inst/intel-Linux/bin/dbx - ./core
Corefile specified executable: "/export/home/sstrunk-tester/SunStudioProjects/Fractal_1/./dist/Debug/OracleSolarisStudio-Linux-x86/fractal_1"
program terminated by signal SEGV (Segmentation fault)
Current function is Mandelbrot
  108       *p = 5;
AOUTCHANGE: /export/home/sstrunk-tester/SunStudioProjects/Fractal_1/./dist/Debug/OracleSolarisStudio-Linux-x86/fractal_1 x86_64 lp64
(dbx-0)
Comment 1 Chihin Ko 2010-04-08 19:10:31 UTC
Dbx engineer Leonard Li investigated the problem in corefile and come to the conclusion of following :

The size of the executable path is 80. This is a hard limit of Linux. "core.good"  works because the executable is invoked by relative path, i.e.

"dist/Debug/OracleSolarisStudio-Linux-x86/fractal_1

which is less than 80 chars.

"core.bad", on the other hand, is invoked as absolute path, i.e.

"/export/home/sstrunk-tester/SunStudioProjects/Fractal_1/dist/Debug/OracleSolari"

which is more than 80 chars and therefore, it is being truncated.

Note that the 80 char limitation is a known problem of Linux, there is a bug against it:

6531863 dbx cannot read a valid core file with a long executable pathname on linux
------------------------------------------------------------------------------
So, IDE run command invoke fractal_1 as an absolute path, is it possible to
invoke fractal_1 as a relative path to work around this problem ?
Comment 2 ivan 2010-04-08 20:54:07 UTC
I don't buy this explanation.
The executable that dbx discovers when the application is run 
_outside_ of the IDE (I.e. "Scanario B") is > 80 characters
yet dbx has no problem figuring it's full size and using it.
How could that be?
Comment 3 Chihin Ko 2010-04-09 00:57:23 UTC
> dist/Debug/OracleSolarisStudio-Linux-x86/fractal_1  <== generate corefile from command line

(dbx-0) p sizeof ("dist/Debug/OracleSolarisStudio-Linux-x86/fractal_1")
sizeof("dist/Debug/OracleSolarisStudio-Linux-x86/fractal_1") = 51

is less than 80
Comment 4 ivan 2010-04-09 01:01:59 UTC
Apparently the > 80 character path that
dbx prints in Scenario B is one that it assembled using a relative
path (< 80 chars) and the current working directory. Tis
also implies that if the core in scenario B is accessed anywhere 
other than where it was dumped dbx will also fail.
Comment 5 Vladimir Voskresensky 2010-04-10 19:27:35 UTC
Could someone explain, what is the CND part of the problem here?