United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7140985 HSDIS does not handle caller options correctly
JDK-7140985 : HSDIS does not handle caller options correctly

Details
Type:
Bug
Submit Date:
2012-01-30
Status:
Closed
Updated Date:
2012-03-28
Project Name:
JDK
Resolved Date:
2012-03-24
Component:
hotspot
OS:
linux_redhat_5.0
Sub-Component:
compiler
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
6u20
Fixed Versions:
hs23 (b16)

Related Reports
Backport:
Backport:

Sub Tasks

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/hsx/hotspot-gc/hotspot/rev/de34c646c3f7
                                     
2012-02-18
EVALUATION

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

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



Hardware and Software, Engineered to Work Together