JDK-7140985 : HSDIS does not handle caller options correctly
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 6u20
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux_redhat_5.0
  • CPU: x86
  • Submitted: 2012-01-30
  • Updated: 2012-03-28
  • Resolved: 2012-03-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 Other
7u4Fixed 8Fixed hs23Fixed
Description
FULL PRODUCT VERSION :
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.10) (fedora-55.1.9.10.fc14-x86_64)
OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)


FULL OS VERSION :
Linux zebedee.pink 2.6.35.14-106.fc14.x86_64 #1 SMP Wed Nov 23 13:07:52 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux


A DESCRIPTION OF THE PROBLEM :
I'm trying to pass an argument to hsdis as a caller option.  It's
not being handled correctly, and I think this is the reason:

static void parse_caller_options(struct hsdis_app_data* app_data, const char* caller_options) {
  char* iop_base = app_data->insn_options;
  char* iop_limit = iop_base + sizeof(app_data->insn_options) - 1;
  char* iop = iop_base;
  const char* p;
  for (p = caller_options; p != NULL; ) {
    const char* q = strchr(p, ',');
    size_t plen = (q == NULL) ? strlen(p) : ((q++) - p);
    if (plen == 4 && strncmp(p, "help", plen) == 0) {
      print_help(app_data, NULL, NULL);
    } else if (plen >= 5 && strncmp(p, "mach=", 5) == 0) {
      char*  mach_option = app_data->mach_option;
      size_t mach_size   = sizeof(app_data->mach_option);
      mach_size -= 1;           /*leave room for the null*/
      if (plen > mach_size)  plen = mach_size;
      strncpy(mach_option, p, plen);
      mach_option[plen] = '\0';
    } else if (plen > 6 && strncmp(p, "hsdis-", 6)) {

Should this be
    ! strncmp(p, "hsdis-", 6)) {

-----------------------------------------------------------------------------
  Subject: Re: hsdis and caller options
  From: John Rose
Date: Thu, 19 Jan 2012 12:02:48 -0800
Cc: hotspot-dev Source Developers <###@###.###>

On Jan 19, 2012, at 9:37 AM, Andrew Haley wrote:

> I'm trying to pass an argument to hsdis as a caller option.  It's
> not being handled correctly, and I think this is the reason:
> 

...

> Should this be
>    ! strncmp(p, "hsdis-", 6)) {

You are correct; that's a bug.

-- John


THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try

THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See the thread at hotspot-dev:

http://mail.openjdk.java.net/pipermail/hotspot-dev/2012-January/005031.html

REPRODUCIBILITY :
This bug can be reproduced always.

Comments
EVALUATION http://hg.openjdk.java.net/lambda/lambda/hotspot/rev/de34c646c3f7
22-03-2012

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-gc/hotspot/rev/de34c646c3f7
18-02-2012

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/de34c646c3f7
11-02-2012