Main Page | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

cfmsgs.c

Go to the documentation of this file.
00001 /*!
00002  * @file cfmsgs.c
00003  *
00004  * @brief Error message for class file functions.
00005  *
00006  * For structure packing mismatches, sprintf requests
00007  * have been moved to functions in
00008  * @link jvm/src/stdio.c stdio.c@endlink
00009  *
00010  *
00011  * @section Control
00012  *
00013  * \$URL: https://svn.apache.org/path/name/cfmsgs.c $ \$Id: cfmsgs.c 0 09/28/2005 dlydick $
00014  *
00015  * Copyright 2005 The Apache Software Foundation
00016  * or its licensors, as applicable.
00017  *
00018  * Licensed under the Apache License, Version 2.0 ("the License");
00019  * you may not use this file except in compliance with the License.
00020  * You may obtain a copy of the License at
00021  *
00022  *     http://www.apache.org/licenses/LICENSE-2.0
00023  *
00024  * Unless required by applicable law or agreed to in writing,
00025  * software distributed under the License is distributed on an
00026  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
00027  * either express or implied.
00028  *
00029  * See the License for the specific language governing permissions
00030  * and limitations under the License.
00031  *
00032  * @version \$LastChangedRevision: 0 $
00033  *
00034  * @date \$LastChangedDate: 09/28/2005 $
00035  *
00036  * @author \$LastChangedBy: dlydick $
00037  *         Original code contributed by Daniel Lydick on 09/28/2005.
00038  *
00039  * @section Reference
00040  *
00041  */
00042 
00043 #include "arch.h"
00044 ARCH_COPYRIGHT_APACHE(cfmsgs, c, "$URL: https://svn.apache.org/path/name/cfmsgs.c $ $Id: cfmsgs.c 0 09/28/2005 dlydick $");
00045 
00046 
00047 #include "jvmcfg.h"
00048 #include "cfmacros.h"
00049 #include "classfile.h"
00050 #include "util.h"
00051 
00052 
00053 /*!
00054  * @brief Display details of what an constant_pool entry contains.
00055  *
00056  * @param  fn     Function name message for sysErrMsg()
00057  *
00058  * @param  pcfs   ClassFile structure containing constant_pool info
00059  *
00060  * @param  cpidx  Index into constant_pool[] to report
00061  *
00062  *
00063  * @returns @link #rvoid rvoid@endlink  The @c @b pcfs->constant_pool
00064  *          must be valid for this to produce any meaningful results.
00065  */
00066 
00067 rvoid cfmsgs_typemsg(rchar *fn,
00068                      ClassFile *pcfs,
00069                      jvm_constant_pool_index cpidx)
00070 {
00071     u4      *pu4, *pu4h, *pu4l;
00072     rulong  *prl8;
00073     rdouble *prd8;
00074 
00075     jint     vali;
00076     jlong    vall;
00077     jfloat   valf;
00078     jdouble  vald;
00079     rint     star_len, star_len2;
00080 
00081     if (CONSTANT_CP_DEFAULT_INDEX == cpidx)
00082     {
00083         /*! @todo  Widen pointer format logic for 64-bit pointers */
00084         sysDbgMsg(DMLNORM,
00085                   fn,
00086                   "NULL index (%d) into constant_pool 0x%08x\n",
00087                   cpidx,
00088                   pcfs);
00089         return;
00090     }
00091 
00092     rchar *msg_hdr = HEAP_GET_DATA(JVMCFG_STDIO_BFR, rfalse);
00093 
00094     u1 tag = CP_TAG(pcfs, cpidx);
00095 
00096     /*
00097      * Explicitly define length calculations of " %*.*s " constructions
00098      * @em outside of the sprintf/fprintf that uses it to simplify
00099      * the calling declarations.  Should make them somewhat easier
00100      * to read.  Use @c @b star_len for one " %*.*s " syntax,
00101      * and use both @c @b star_len and @c @b star_len2
00102      * for " %*.*s   ...   %*.*s " syntax.
00103      *
00104      * DO NOT use " %*s " format!!  It will print <i>at least</i> that
00105      * number of bytes, until a @b \0 or end of heap segment, which
00106      * may cause @b SIGSEGV!
00107      */
00108     star_len = (jvm_class_index_null == pcfs->this_class)
00109                    ? 7 /* Length of string "unknown" as used below */
00110                    : CP1_NAME_STRLEN(CONSTANT_Class_info,
00111                                      pcfs,
00112                                      pcfs->this_class,
00113                                      name_index);
00114     sprintfLocal(msg_hdr,
00115                  "%*.*s cpidx=0x%02x tag=%d",
00116 
00117                  star_len, star_len,
00118                  (jvm_class_index_null == pcfs->this_class)
00119                     ? ((rchar *) "unknown")
00120                     : (rchar *)PTR_CP1_NAME_STRNAME(CONSTANT_Class_info,
00121                                                     pcfs,
00122                                                     pcfs->this_class,
00123                                                     name_index),
00124                  cpidx,
00125                  tag);
00126 
00127     switch(tag)
00128     {
00129         case CONSTANT_Class:
00130 
00131             star_len = CP1_NAME_STRLEN(CONSTANT_Class_info,
00132                                        pcfs,
00133                                        cpidx,
00134                                        name_index);
00135             sysDbgMsg(DMLNORM,
00136                       fn,
00137                     "%s Class cpidx=0x%02x clsidx=%d len=%d %*.*s",
00138                       msg_hdr,
00139                       PTR_CP_ENTRY_TYPE(CONSTANT_Class_info, pcfs,cpidx)
00140                           ->name_index,
00141 
00142                       PTR_CP_ENTRY_TYPE(CONSTANT_Class_info, pcfs,cpidx)
00143                           ->LOCAL_Class_binding.clsidxJVM,
00144 
00145                       star_len,
00146 
00147                       star_len, star_len,
00148                       PTR_CP1_NAME_STRNAME(CONSTANT_Class_info,
00149                                            pcfs,
00150                                            cpidx,
00151                                            name_index));
00152 
00153             break;
00154 
00155         case CONSTANT_Fieldref:
00156 
00157             star_len = CP2_CLASS_NAME_STRLEN(CONSTANT_Fieldref_info,
00158                                              pcfs,
00159                                              cpidx,
00160                                              class_index);
00161 
00162             star_len2 = CP2_CLASS_NAME_STRLEN(CONSTANT_Fieldref_info,
00163                                               pcfs,
00164                                               cpidx,
00165                                               name_and_type_index);
00166 
00167             sysDbgMsg(DMLNORM,
00168                       fn,
00169 "%s Fieldref cpidx=0x%02x clsidx=%d fluidx=%d oiflag=%d jvalue=%c len=%d class=%*.*s cpidx=0x%02x len=%d n/t=%*.*s",
00170                       msg_hdr,
00171                     PTR_CP_ENTRY_TYPE(CONSTANT_Fieldref_info,pcfs,cpidx)
00172                           ->class_index,
00173 
00174                     PTR_CP_ENTRY_TYPE(CONSTANT_Fieldref_info,pcfs,cpidx)
00175                           ->LOCAL_Fieldref_binding.clsidxJVM,
00176                     PTR_CP_ENTRY_TYPE(CONSTANT_Fieldref_info,pcfs,cpidx)
00177                           ->LOCAL_Fieldref_binding.fluidxJVM,
00178                     PTR_CP_ENTRY_TYPE(CONSTANT_Fieldref_info,pcfs,cpidx)
00179                           ->LOCAL_Fieldref_binding.oiflagJVM,
00180                     PTR_CP_ENTRY_TYPE(CONSTANT_Fieldref_info,pcfs,cpidx)
00181                           ->LOCAL_Fieldref_binding.jvaluetypeJVM,
00182 
00183                       star_len,
00184 
00185                       star_len, star_len,
00186                       PTR_CP2_CLASS_NAME_STRNAME(CONSTANT_Fieldref_info,
00187                                                  pcfs,
00188                                                  cpidx,
00189                                                  class_index),
00190 
00191                     PTR_CP_ENTRY_TYPE(CONSTANT_Fieldref_info,pcfs,cpidx)
00192                           ->name_and_type_index,
00193 
00194                       star_len2,
00195 
00196                       star_len2, star_len2,
00197                       PTR_CP2_CLASS_NAME_STRNAME(CONSTANT_Fieldref_info,
00198                                                  pcfs,
00199                                                  cpidx,
00200                                                  name_and_type_index));
00201             break;
00202 
00203         case CONSTANT_Methodref:
00204 
00205             star_len = CP2_CLASS_NAME_STRLEN(CONSTANT_Methodref_info,
00206                                               pcfs,
00207                                               cpidx,
00208                                               class_index);
00209             star_len2 = CP2_CLASS_NAME_STRLEN(CONSTANT_Methodref_info,
00210                                               pcfs,
00211                                               cpidx,
00212                                               name_and_type_index);
00213             sysDbgMsg(DMLNORM,
00214                       fn,
00215 "%s %s cpidx=0x%02x clsidx=%d mthidx=%d caidx=%d eaidx=%d nmo=%d len=%d class=%*.*s cpidx=0x%02x len=%d n/t=%*.*s",
00216                       msg_hdr,
00217                       "Methodref",
00218                       PTR_CP_ENTRY_TYPE(CONSTANT_Methodref_info,
00219                                         pcfs,
00220                                         cpidx)->class_index,
00221 
00222                    PTR_CP_ENTRY_TYPE(CONSTANT_Methodref_info,pcfs,cpidx)
00223                        ->LOCAL_Methodref_binding.clsidxJVM,
00224                    PTR_CP_ENTRY_TYPE(CONSTANT_Methodref_info,pcfs,cpidx)
00225                        ->LOCAL_Methodref_binding.mthidxJVM,
00226                    PTR_CP_ENTRY_TYPE(CONSTANT_Methodref_info,pcfs,cpidx)
00227                        ->LOCAL_Methodref_binding.codeatridxJVM,
00228                    PTR_CP_ENTRY_TYPE(CONSTANT_Methodref_info,pcfs,cpidx)
00229                        ->LOCAL_Methodref_binding.excpatridxJVM,
00230                    PTR_CP_ENTRY_TYPE(CONSTANT_Methodref_info,pcfs,cpidx)
00231                        ->LOCAL_Methodref_binding.nmordJVM,
00232 
00233                       star_len,
00234 
00235                       star_len, star_len,
00236                      PTR_CP2_CLASS_NAME_STRNAME(CONSTANT_Methodref_info,
00237                                                 pcfs,
00238                                                 cpidx,
00239                                                 class_index),
00240 
00241                       PTR_CP_ENTRY_TYPE(CONSTANT_Methodref_info,
00242                                         pcfs,
00243                                         cpidx)->name_and_type_index,
00244 
00245                       star_len2,
00246 
00247                       star_len2, star_len2,
00248                      PTR_CP2_CLASS_NAME_STRNAME(CONSTANT_Methodref_info,
00249                                                 pcfs,
00250                                                 cpidx,
00251                                                 name_and_type_index));
00252             break;
00253 
00254         case CONSTANT_InterfaceMethodref:
00255 
00256             star_len = CP2_CLASS_NAME_STRLEN(
00257                                        CONSTANT_InterfaceMethodref_info,
00258                                              pcfs,
00259                                              cpidx,
00260                                              class_index);
00261             star_len2 = CP2_CLASS_NAME_STRLEN(
00262                                        CONSTANT_InterfaceMethodref_info,
00263                                               pcfs,
00264                                               cpidx,
00265                                               name_and_type_index),
00266             sysDbgMsg(DMLNORM,
00267                       fn,
00268 "%s %s cpidx=0x%02x clsidx=%d mthidx=%d caidx=%d eaidx=%d nmo=%d len=%d class=%*.*s cpidx=0x%02x len=%d n/t=%*.*s",
00269                       msg_hdr,
00270                       "InterfaceMethodref", /* Keep fmt string small */
00271                       PTR_CP_ENTRY_TYPE(
00272                                        CONSTANT_InterfaceMethodref_info,
00273                                        pcfs,
00274                                        cpidx)->class_index,
00275                      PTR_CP_ENTRY_TYPE(CONSTANT_InterfaceMethodref_info,
00276                                        pcfs,
00277                                        cpidx)
00278                           ->LOCAL_InterfaceMethodref_binding.clsidxJVM,
00279                      PTR_CP_ENTRY_TYPE(CONSTANT_InterfaceMethodref_info,
00280                                        pcfs,
00281                                        cpidx)
00282                           ->LOCAL_InterfaceMethodref_binding.mthidxJVM,
00283                      PTR_CP_ENTRY_TYPE(CONSTANT_InterfaceMethodref_info,
00284                                        pcfs,
00285                                        cpidx)
00286                           ->LOCAL_InterfaceMethodref_binding
00287                             .codeatridxJVM,
00288                      PTR_CP_ENTRY_TYPE(CONSTANT_InterfaceMethodref_info,
00289                                        pcfs,
00290                                        cpidx)
00291                           ->LOCAL_InterfaceMethodref_binding
00292                             .excpatridxJVM,
00293                      PTR_CP_ENTRY_TYPE(CONSTANT_InterfaceMethodref_info,
00294                                        pcfs,
00295                                        cpidx)
00296                           ->LOCAL_InterfaceMethodref_binding
00297                             .nmordJVM,
00298 
00299                       star_len,
00300 
00301                       star_len, star_len,
00302                       PTR_CP2_CLASS_NAME_STRNAME(
00303                                        CONSTANT_InterfaceMethodref_info,
00304                                                  pcfs,
00305                                                  cpidx,
00306                                                  class_index),
00307 
00308                       PTR_CP_ENTRY_TYPE(
00309                                        CONSTANT_InterfaceMethodref_info,
00310                                        pcfs,
00311                                        cpidx)->name_and_type_index,
00312 
00313                       star_len2,
00314 
00315                       star_len2, star_len2,
00316                       PTR_CP2_CLASS_NAME_STRNAME(
00317                                        CONSTANT_InterfaceMethodref_info,
00318                                                  pcfs,
00319                                                  cpidx,
00320                                                  name_and_type_index));
00321             break;
00322 
00323         case CONSTANT_String:
00324 
00325             star_len = CP1_NAME_STRLEN(CONSTANT_String_info,
00326                                        pcfs,
00327                                        cpidx,
00328                                        string_index);
00329             sysDbgMsg(DMLNORM,
00330                       fn,
00331                 "%s String cpidx=0x%02x len=%d UTF8='%*.*s'",
00332                       msg_hdr,
00333                      PTR_CP_ENTRY_TYPE(CONSTANT_String_info, pcfs,cpidx)
00334                           ->string_index,
00335 
00336                       star_len,
00337 
00338                       star_len, star_len,
00339                       PTR_CP1_NAME_STRNAME(CONSTANT_String_info,
00340                                            pcfs,
00341                                            cpidx,
00342                                            string_index));
00343             break;
00344 
00345         case CONSTANT_Integer:
00346 
00347             pu4 = &PTR_CP_ENTRY_TYPE(CONSTANT_Integer_info,
00348                                      pcfs,
00349                                      cpidx)->bytes;
00350 
00351             vali = GETRI4(pu4);
00352 
00353             sysDbgMsg(DMLNORM, fn, "%s Integer value=%d", msg_hdr,vali);
00354             break;
00355 
00356         case CONSTANT_Float:
00357 
00358             pu4 = &PTR_CP_ENTRY_TYPE(CONSTANT_Float_info,
00359                                      pcfs,
00360                                      cpidx)->bytes;
00361 
00362             valf = (jfloat) GETRI4(pu4);
00363 
00364             sysDbgMsg(DMLNORM, fn, "%s Float value=%f", msg_hdr, valf);
00365             break;
00366 
00367         case CONSTANT_Long:
00368 
00369             pu4h = &PTR_CP_ENTRY_TYPE(CONSTANT_Long_info, pcfs, cpidx)
00370                         ->high_bytes;
00371             pu4l = &PTR_CP_ENTRY_TYPE(CONSTANT_Long_info, pcfs, cpidx)
00372                         ->low_bytes;
00373 
00374             /*
00375              * if WORDSIZE/32/64 mismatches -m32/-m64,
00376              * the <b><code>JBITS * sizeof(u4)</code></b> calculation
00377              * @e will cause a runtime-visible compiler
00378              * warning!
00379              */
00380 
00381 /*
00382  *          vall = (jlong) ((((julong) *pu4h) << (JBITS * sizeof(u4))) |
00383  *                          ((julong) *pu4l));
00384  */
00385 
00386 /*! @todo  Above logic works, 64-bitlogic below needs testing: */
00387             /* LS word always follows MS word */
00388             prl8 = (rulong *) pu4h;
00389             vall = (jlong) GETRL8(prl8);
00390 
00391             /*! @todo  Make format string properly reflect 64-bit int */
00392             sysDbgMsg(DMLNORM, fn, "%s Long value=%ld", msg_hdr, vall);
00393             break;
00394 
00395         case CONSTANT_Double:
00396 
00397             pu4h = &PTR_CP_ENTRY_TYPE(CONSTANT_Double_info, pcfs, cpidx)
00398                        ->high_bytes;
00399             pu4l = &PTR_CP_ENTRY_TYPE(CONSTANT_Double_info, pcfs, cpidx)
00400                        ->low_bytes;
00401 
00402             /*
00403              * if WORDSIZE/32/64 mismatches -m32/-m64,
00404              * the <b><code>JBITS * sizeof(u4)</code></b> calculation
00405              * @e will cause a runtime-visible compiler
00406              * warning!
00407              */
00408 
00409 /*
00410  *          vald = (jdouble) ((((julong) *pu4h) <<(JBITS * sizeof(u4)))|
00411  *                          ((julong) *pu4l));
00412  */
00413 
00414 /*! @todo  Above logic works, 64-bit logic below needs testing: */
00415             /* LS word always follows MS word */
00416             prd8 = (rdouble *) pu4h;
00417             vald = (jdouble) GETRL8((rulong *) prd8);
00418 
00419             sysDbgMsg(DMLNORM, fn, "%s Double value=%lf", msg_hdr,vald);
00420             break;
00421 
00422         case CONSTANT_NameAndType:
00423 
00424             star_len = CP1_NAME_STRLEN(CONSTANT_NameAndType_info,
00425                                        pcfs,
00426                                        cpidx,
00427                                        name_index);
00428             star_len2 = CP1_NAME_STRLEN(CONSTANT_NameAndType_info,
00429                                         pcfs,
00430                                         cpidx,
00431                                         descriptor_index);
00432             sysDbgMsg(DMLNORM,
00433                       fn,
00434   "%s %s cpidx=0x%02x len=%d name=%*.*s cpidx=0x%02x len=%d desc=%*.*s",
00435                       msg_hdr,
00436                       "NameAndType",
00437                       PTR_CP_ENTRY_TYPE(CONSTANT_NameAndType_info,
00438                                         pcfs,
00439                                         cpidx)->name_index,
00440 
00441                       star_len,
00442 
00443                       star_len, star_len,
00444                       PTR_CP1_NAME_STRNAME(CONSTANT_NameAndType_info,
00445                                            pcfs,
00446                                            cpidx,
00447                                            name_index),
00448 
00449                       PTR_CP_ENTRY_TYPE(CONSTANT_NameAndType_info,
00450                                         pcfs,
00451                                         cpidx)->descriptor_index,
00452 
00453                       star_len2,
00454 
00455                       star_len2, star_len2,
00456                       PTR_CP1_NAME_STRNAME(CONSTANT_NameAndType_info,
00457                                            pcfs,
00458                                            cpidx,
00459                                            descriptor_index));
00460             break;
00461 
00462         case CONSTANT_Utf8:
00463 
00464             star_len = CP_THIS_STRLEN(pcfs, cpidx);
00465             sysDbgMsg(DMLNORM,
00466                       fn,
00467                       "%s Constant len=%d UTF8='%*.*s'",
00468                       msg_hdr,
00469 
00470                       star_len,
00471 
00472                       star_len, star_len,
00473                       PTR_CP_THIS_STRNAME(pcfs, cpidx));
00474             break;
00475 
00476         default:
00477 
00478             sysDbgMsg(DMLNORM, fn, "%s \a UNKNOWN TAG", msg_hdr);
00479             break;
00480 
00481     } /* switch (tag) */
00482 
00483     HEAP_FREE_DATA(msg_hdr);
00484 
00485     return;
00486 
00487 } /* END of cfmsgs_typemsg() */
00488 
00489 
00490 /*!
00491  * @brief Show all entries in the constant pool
00492  *
00493  *
00494  * @param  pcfs    ClassFile to dump contents
00495  *
00496  *
00497  * @returns @link #rvoid rvoid@endlink
00498  *
00499  */
00500 rvoid cfmsgs_show_constant_pool(ClassFile *pcfs)
00501 {
00502     jvm_constant_pool_index cpidx;
00503 
00504     /*
00505      * Rehearse contents of constant_pool (Wait until AFTER the
00506      * @link ClassFile.this_class this_class@endlink item is located
00507      * so that the message prints the class name instead of a
00508      * default @b "unknown" for the class name.
00509      */
00510     for (cpidx = CONSTANT_CP_START_INDEX;
00511          cpidx < pcfs->constant_pool_count + CONSTANT_CP_START_INDEX -1;
00512          cpidx++)
00513     {
00514         cfmsgs_typemsg("cpload", pcfs, cpidx);
00515 
00516     } /* for (cpidx) */
00517 
00518 } /* END of cfmsgs_show_constant_pool() */
00519 
00520 
00521 /*!
00522  * @brief Display details of what an attribute entry contains.
00523  *
00524  * @param  fn     Function name message for sysErrMsg()
00525  *
00526  * @param  pcfs    ClassFile to dump contents
00527  *
00528  * @param  atr    Pointer to an attribute area.  WARNING:  This
00529  *                  pointer MUST be 4-byte aligned to suppress
00530  *                  @b SIGSEGV.  Such logic is already taken care
00531  *                  of by virtue of it being an (attribute_info_dup *)
00532  *                  type instead of as (attribute_info *).  This
00533  *                  processing happens in cfattrib_loadattribute()
00534  *                  after reading an attribute from the class file
00535  *                  and storing it into the heap, which is properly
00536  *                  aligned.
00537  *
00538  * @returns @link #rvoid rvoid@endlink The
00539  *          @c @b atr->ai.attribute_index constant_pool entry
00540  *          must be valid for this to produce any meaningful
00541  *          results.
00542  */
00543 
00544 rvoid cfmsgs_atrmsg(rchar *fn,
00545                     ClassFile *pcfs,
00546                     attribute_info_dup *atr)
00547 {
00548     u4      *pu4, *pu4h, *pu4l;
00549     rulong  *prl8;
00550     rdouble *prd8;
00551 
00552     jint     vali;
00553     jlong    vall;
00554     jfloat   valf;
00555     jdouble  vald;
00556     rint     star_len;
00557 
00558     rchar *msg_hdr = HEAP_GET_DATA(JVMCFG_STDIO_BFR, rfalse);
00559 
00560     u2 cpidx = atr->ai.attribute_name_index;
00561     u4 len = atr->ai.attribute_length;
00562 
00563     star_len = (jvm_class_index_null == pcfs->this_class)
00564                    ? 7 /* Length of string "unknown" as used below */
00565                    : CP1_NAME_STRLEN(CONSTANT_Class_info,
00566                                      pcfs,
00567                                      pcfs->this_class,
00568                                      name_index);
00569     sprintfLocal(msg_hdr,
00570                  "%*.*s cpidx=%02x len=%d ",
00571                  star_len, star_len,
00572                  (jvm_class_index_null == pcfs->this_class)
00573                     ? ((rchar *) "unknown")
00574                     : (rchar *)PTR_CP1_NAME_STRNAME(CONSTANT_Class_info,
00575                                                     pcfs,
00576                                                     pcfs->this_class,
00577                                                     name_index),
00578                  cpidx,
00579                  len);
00580 
00581     switch(cfattrib_atr2enum(pcfs, atr->ai.attribute_name_index))
00582     {
00583         case LOCAL_CONSTANTVALUE_ATTRIBUTE:
00584             switch((int) CP_TAG(pcfs, cpidx))
00585             {
00586 /*!
00587  * @todo  Verify (jlong) retrieval of @c @b bytes for
00588  * both -m32 and -m64 compilations.
00589  */
00590                 case CONSTANT_Long:
00591 
00592                     pu4h = &PTR_CP_ENTRY_TYPE(CONSTANT_Long_info,
00593                                               pcfs,
00594                                               cpidx)->high_bytes;
00595                     pu4l = &PTR_CP_ENTRY_TYPE(CONSTANT_Long_info,
00596                                               pcfs,
00597                                               cpidx)->low_bytes;
00598 
00599                     /*
00600                      * if WORDSIZE/32/64 mismatches -m32/-m64,
00601                      * the <b><code>JBITS * sizeof(u4)</code></b>
00602                      * calculation @e will cause a runtime-visible
00603                      * compiler warning!
00604                      */
00605 /*
00606  *                  vall = (jlong) ((((julong) *pu4h) <<
00607  *                                   (JBITS * sizeof(u4))) |
00608  *                                  ((julong) *pu4l));
00609  */
00610 
00611 /*! @todo  Above logic works, logic below needs testing: */
00612                     /* LS word always follows MS word */
00613                     prl8 = (rulong *) pu4h;
00614                     vall = (jlong) GETRL8(prl8);
00615 
00616 
00617                     /*! @todo  Make format string properly
00618                               reflect 64-bit (rlong)/(jlong) */
00619                     sysDbgMsg(DMLNORM,
00620                               fn, "%s %s long=%ld",
00621                               msg_hdr,
00622                               CONSTANT_UTF8_CONSTANTVALUE_ATTRIBUTE,
00623                               vall);
00624                     break;
00625 
00626 /*!
00627  * @todo  Verify (jfloat) retrieval of @c @b bytes for
00628  * both -m32 and -m64 compilations.
00629  */
00630                 case CONSTANT_Float:
00631 
00632                     pu4 = &PTR_CP_ENTRY_TYPE(CONSTANT_Float_info,
00633                                              pcfs,
00634                                              cpidx)->bytes;
00635                     valf = (jfloat) (jint) *pu4;
00636 
00637                     sysDbgMsg(DMLNORM,
00638                               fn, "%s %s float=%f",
00639                               msg_hdr,
00640                               CONSTANT_UTF8_CONSTANTVALUE_ATTRIBUTE,
00641                               valf);
00642                     break;
00643 
00644 /*!
00645  * @todo  Verify (jdouble) retrieval of @c @b bytes for
00646  * both -m32 and -m64 compilations.
00647  */
00648                 case CONSTANT_Double:
00649 
00650                     pu4h = &PTR_CP_ENTRY_TYPE(CONSTANT_Double_info,
00651                                               pcfs,
00652                                               cpidx)->high_bytes;
00653                     pu4l = &PTR_CP_ENTRY_TYPE(CONSTANT_Double_info,
00654                                               pcfs,
00655                                               cpidx)->low_bytes;
00656 
00657                     /*
00658                      * if WORDSIZE/32/64 mismatches -m32/-m64,
00659                      * the <b><code>JBITS * sizeof(u4)</code></b>
00660                      * calculation @e will cause a runtime-visible
00661                      * compiler warning!
00662                      */
00663 /*
00664  *                  vald = (jdouble) ((((julong) *pu4h) <<
00665  *                                     (JBITS * sizeof(u4))) |
00666  *                                    ((julong) *pu4l));
00667  */
00668 /*! @todo  Above logic works, 64-bit logic below needs testing: */
00669                     /* LS word always follows MS word */
00670                     prd8 = (rdouble *) pu4h;
00671                     vald = (jdouble) GETRL8((rulong *) prd8);
00672 
00673 
00674                     /*! @todo  Make format string properly
00675                                reflect 64-bit (double)/(jdouble) */
00676                     sysDbgMsg(DMLNORM,
00677                               fn, "%s %s double=%ld",
00678                               msg_hdr,
00679                               CONSTANT_UTF8_CONSTANTVALUE_ATTRIBUTE,
00680                               vald);
00681                     break;
00682 
00683 /*!
00684  * @todo  Verify (jint) retrieval of @c @b bytes for
00685  * both -m32 and -m64 compilations.
00686  */
00687                 case CONSTANT_Integer:
00688 
00689                     pu4 = &PTR_CP_ENTRY_TYPE(CONSTANT_Integer_info,
00690                                              pcfs,
00691                                              cpidx)->bytes;
00692                     vali = (jint) *pu4;
00693 
00694                     sysDbgMsg(DMLNORM,
00695                               fn, "%s %s int_type=%d",
00696                               msg_hdr,
00697                               CONSTANT_UTF8_CONSTANTVALUE_ATTRIBUTE,
00698                               vali);
00699                     break;
00700 
00701                 case CONSTANT_String:
00702 
00703                     star_len = CP_THIS_STRLEN(pcfs, cpidx);
00704                     sysDbgMsg(DMLNORM,
00705                               fn,
00706                         "%s %s String cpidx=0x%02x len=%d UTF8='%*.*s'",
00707                               msg_hdr,
00708                               CONSTANT_UTF8_CONSTANTVALUE_ATTRIBUTE,
00709                               cpidx,
00710                               star_len,
00711 
00712                               star_len, star_len,
00713                               PTR_CP_THIS_STRNAME(pcfs, cpidx));
00714                     break;
00715 
00716                 default:
00717 
00718                     sysDbgMsg(DMLNORM,
00719                               fn,
00720                               "%s %s  unknown tag=%d",
00721                               msg_hdr,
00722                               LOCAL_CONSTANT_UTF8_UNKNOWN_ATTRIBUTE,
00723                               CP_TAG(pcfs, cpidx));
00724                     break;
00725 
00726             } /* switch CP_TAG(pcfs, cpidx) */
00727 
00728             break;
00729 
00730         case LOCAL_CODE_ATTRIBUTE:
00731 
00732             sysDbgMsg(DMLNORM,
00733                       fn,
00734                       "%s %s stack=%d locals=%d len=%d",
00735                       msg_hdr,
00736                       CONSTANT_UTF8_CODE_ATTRIBUTE,
00737                       PTR_CP_ENTRY_TYPE(Code_attribute, pcfs, cpidx)
00738                           ->max_stack,
00739                       PTR_CP_ENTRY_TYPE(Code_attribute, pcfs, cpidx)
00740                           ->max_locals,
00741                       PTR_CP_ENTRY_TYPE(Code_attribute, pcfs, cpidx)
00742                           ->code_length);
00743             break;
00744 
00745         case LOCAL_EXCEPTIONS_ATTRIBUTE:
00746 
00747             sysDbgMsg(DMLNORM,
00748                       fn,
00749                       "%s %s num=%d",
00750                       msg_hdr,
00751                       CONSTANT_UTF8_CODE_ATTRIBUTE,
00752                      PTR_CP_ENTRY_TYPE(Exceptions_attribute, pcfs,cpidx)
00753                           ->number_of_exceptions);
00754             break;
00755 
00756         case LOCAL_INNERCLASSES_ATTRIBUTE:
00757 
00758             sysDbgMsg(DMLNORM,
00759                       fn,
00760                       "%s %s num=%d",
00761                       msg_hdr,
00762                       CONSTANT_UTF8_INNERCLASSES_ATTRIBUTE,
00763                       PTR_CP_ENTRY_TYPE(InnerClasses_attribute,
00764                                         pcfs,
00765                                         cpidx)->number_of_classes);
00766             break;
00767 
00768         case LOCAL_ENCLOSINGMETHOD_ATTRIBUTE:
00769 
00770             sysDbgMsg(DMLNORM,
00771                       fn,
00772                       "%s %s clsidx=%d mthidx=%d",
00773                       msg_hdr,
00774                       CONSTANT_UTF8_ENCLOSINGMETHOD_ATTRIBUTE,
00775                       PTR_CP_ENTRY_TYPE(EnclosingMethod_attribute,
00776                                         pcfs,
00777                                         cpidx)->class_index,
00778                       PTR_CP_ENTRY_TYPE(EnclosingMethod_attribute,
00779                                         pcfs,
00780                                         cpidx)->method_index);
00781             break;
00782 
00783         case LOCAL_SYNTHETIC_ATTRIBUTE:
00784 
00785             sysDbgMsg(DMLNORM,
00786                       fn,
00787                       "%s %s",
00788                       msg_hdr,
00789                       CONSTANT_UTF8_SYNTHETIC_ATTRIBUTE);
00790             break;
00791 
00792         case LOCAL_SIGNATURE_ATTRIBUTE:
00793 
00794             sysDbgMsg(DMLNORM,
00795                       fn,
00796                       "%s %s cpidx=0x%02x",
00797                       msg_hdr,
00798                       CONSTANT_UTF8_SIGNATURE_ATTRIBUTE,
00799                       PTR_CP_ENTRY_TYPE(Signature_attribute,
00800                                         pcfs,
00801                                         cpidx)->signature_index);
00802             break;
00803 
00804         case LOCAL_SOURCEFILE_ATTRIBUTE:
00805 
00806             sysDbgMsg(DMLNORM,
00807                       fn,
00808                       "%s %s cpidx=0x%02x",
00809                       msg_hdr,
00810                       CONSTANT_UTF8_SOURCEFILE_ATTRIBUTE,
00811                       PTR_CP_ENTRY_TYPE(SourceFile_attribute,
00812                                         pcfs,
00813                                         cpidx)->sourcefile_index);
00814             break;
00815 
00816         case LOCAL_LINENUMBERTABLE_ATTRIBUTE:
00817 
00818             sysDbgMsg(DMLNORM,
00819                       fn,
00820                       "%s %s len=%d",
00821                       msg_hdr,
00822                       CONSTANT_UTF8_LINENUMBERTABLE_ATTRIBUTE,
00823                       PTR_CP_ENTRY_TYPE(LineNumberTable_attribute,
00824                                         pcfs,
00825                                       cpidx)->line_number_table_length);
00826             break;
00827 
00828         case LOCAL_LOCALVARIABLETABLE_ATTRIBUTE:
00829 
00830             sysDbgMsg(DMLNORM,
00831                       fn,
00832                       "%s %s len=%d",
00833                       msg_hdr,
00834                       CONSTANT_UTF8_LOCALVARIABLETABLE_ATTRIBUTE,
00835                       PTR_CP_ENTRY_TYPE(LocalVariableTable_attribute,
00836                                         pcfs,
00837                                         cpidx)
00838                           ->local_variable_table_length);
00839             break;
00840 
00841         case LOCAL_LOCALVARIABLETYPETABLE_ATTRIBUTE:
00842 
00843             sysDbgMsg(DMLNORM,
00844                       fn,
00845                       "%s %s len=%d",
00846                       msg_hdr,
00847                       CONSTANT_UTF8_LOCALVARIABLETYPETABLE_ATTRIBUTE,
00848                       PTR_CP_ENTRY_TYPE(
00849                                        LocalVariableTypeTable_attribute,
00850                                        pcfs,
00851                                        cpidx)
00852                           ->local_variable_type_table_length);
00853             break;
00854 
00855         case LOCAL_DEPRECATED_ATTRIBUTE:
00856 
00857             sysDbgMsg(DMLNORM,
00858                       fn,
00859                       "%s %s",
00860                       msg_hdr,
00861                       CONSTANT_UTF8_DEPRECATED_ATTRIBUTE);
00862             break;
00863 
00864         case LOCAL_RUNTIMEVISIBLEANNOTATIONS_ATTRIBUTE:
00865 
00866             sysDbgMsg(DMLNORM,
00867                       fn,
00868                       "%s %s num=%d",
00869                       msg_hdr,
00870                       CONSTANT_UTF8_RUNTIMEVISIBLEANNOTATIONS_ATTRIBUTE,
00871                       PTR_CP_ENTRY_TYPE(
00872                                     RuntimeVisibleAnnotations_attribute,
00873                                         pcfs,
00874                                         cpidx)->num_annotations);
00875             break;
00876 
00877         case LOCAL_RUNTIMEINVISIBLEANNOTATIONS_ATTRIBUTE:
00878 
00879             sysDbgMsg(DMLNORM,
00880                       fn,
00881                       "%s %s num=%d",
00882                       msg_hdr,
00883                     CONSTANT_UTF8_RUNTIMEINVISIBLEANNOTATIONS_ATTRIBUTE,
00884                       PTR_CP_ENTRY_TYPE(
00885                                   RuntimeInvisibleAnnotations_attribute,
00886                                         pcfs,
00887                                         cpidx)->num_annotations);
00888             break;
00889 
00890         case LOCAL_RUNTIMEVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE:
00891 
00892             sysDbgMsg(DMLNORM,
00893                       fn,
00894                       "%s %s num=%d",
00895                       msg_hdr,
00896              CONSTANT_UTF8_RUNTIMEVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE,
00897                PTR_CP_ENTRY_TYPE(
00898                            RuntimeVisibleParameterAnnotations_attribute,
00899                                  pcfs,
00900                                  cpidx)->num_parameters);
00901             break;
00902 
00903         case LOCAL_RUNTIMEINVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE:
00904 
00905             sysDbgMsg(DMLNORM,
00906                       fn,
00907                       "%s %s num=%d",
00908                       msg_hdr,
00909            CONSTANT_UTF8_RUNTIMEINVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE,
00910                       PTR_CP_ENTRY_TYPE(
00911                          RuntimeInvisibleParameterAnnotations_attribute,
00912                                         pcfs,
00913                                         cpidx)->num_parameters);
00914             break;
00915 
00916         case LOCAL_ANNOTATIONDEFAULT_ATTRIBUTE:
00917 
00918             sysDbgMsg(DMLNORM,
00919                       fn,
00920                       "%s %s tag=%d",
00921                       msg_hdr,
00922                       CONSTANT_UTF8_ANNOTATIONDEFAULT_ATTRIBUTE,
00923                       PTR_CP_ENTRY_TYPE(AnnotationDefault_attribute,
00924                                         pcfs,
00925                                         cpidx)->default_value.tag);
00926             break;
00927 
00928         case LOCAL_UNKNOWN_ATTRIBUTE:
00929 
00930         default:
00931 
00932             sysDbgMsg(DMLNORM,
00933                       fn,
00934                       "%s %s tag=%d",
00935                       msg_hdr,
00936                       LOCAL_CONSTANT_UTF8_UNKNOWN_ATTRIBUTE,
00937                       CP_TAG(pcfs, cpidx));
00938             break;
00939 
00940     } /* switch atrIndexToEmum() */
00941 
00942     HEAP_FREE_DATA(msg_hdr);
00943 
00944     return;
00945 
00946 } /* END of cfmsgs_atrmsg() */
00947 
00948 
00949 /* EOF */
00950 

Generated on Fri Sep 30 18:48:59 2005 by  doxygen 1.4.4