JavaScript is required to for searching.
ナビゲーションリンクをスキップ
印刷ビューの終了
Oracle Solaris Studio 12.2 Discover および Uncover ユーザーズガイド
search filter icon
search icon

ドキュメントの情報

はじめに

1.  概要

2.  Sun メモリエラー探索ツール (Discover)

Discover を使用するための要件

バイナリは正しく準備される必要がある

プリロードまたは監査を使用するバイナリは使用できまい

クイックスタート

準備されたバイナリの計測

共有ライブラリのキャッシュ

共有ライブラリの計測

ライブラリの無視

コマンド行オプション

出力オプション

計測オプション

キャッシュオプション

その他のオプション

bit.rc 初期化ファイル

SUNW_DISCOVER_OPTIONS 環境変数

計測済みバイナリの実行

Discover レポートの分析

HTML レポートの分析

「エラー (Errors)」タブの使用法

「警告 (Warnings)」タブの使用法

「メモリーリーク (Memory Leaks)」タブの使用法

コントロールパネルの使用法

ASCII レポートの分析

メモリーアクセスエラーと警告

メモリーアクセスエラー

ABR

ABW

BFM

BRP

DFM

FMR

FMW

FRP

IMR

IMW

PIR

UAR

UAW

UMR

メモリーアクセスの警告

AZS

Discover エラーメッセージの解釈

部分的に初期化されたメモリー

スペキュレイティブロード

未計測コード

Discover 使用時の制限事項

注釈付きコードのみが計測される

機械命令はソースコードとは異なる場合がある

コンパイラオプションは生成されたコードに影響を及ぼす

システムライブラリは報告されたエラーに影響を及ぼす可能性がある

カスタムメモリー管理はデータの正確さに影響を及ぼす可能性がある

静的および自動配列範囲外は削除できない

3.  コードカバレッジツール (Uncover)

索引

メモリーアクセスエラーと警告

Discover は多数のメモリーアクセスエラー、およびエラーである可能性のあるアクセスに関する警告を検出および報告します。

メモリーアクセスエラー

Discover は次のメモリーアクセスエラーを検出します。

次のセクションに、これらのエラーの一部を生成する簡単なサンプルプログラムを一覧表示します。

ABR
#include <stdio.h>
#include <stdlib.h>
int main()
{
  //  ABR: reading memory beyond array bounds at address 0x%1x (%d byte%s)"
  int *a = (int*) malloc(sizeof(int[5]));
  printf("a[5] = %d\n",a[5]);
)
ABW
#include <stdlib.h>
int main()
{
  //  ABW:  writing to memory beyond array bounds
  int *a = (int*) malloc(sizeof(int[5]));
  a[5] = 5;
}
BFM
#include <stdlib.h>
int main()
{

  //  BFM:  freeing wrong memory block
  int *p = (int*) malloc(sizeof(int));
  free(p+1);
}
BRP
#include <stdlib.h>
int main()
{
  //  BRP is "bad address parameter for realloc 0x%1x"
  int *p = (int*) realloc(0,sizeof(int));
  int *q = (int*) realloc(p+20,sizeof(int[2]));
}
DFM
#include <stdlib.h>
int main()
{
  // DFM is "double freeing memory"
  int *p = (int*) malloc(sizeof(int));
  free(p);
  free(p);'
}
FMR
#includ <stdio.h>
#include <stdlib.h>
int main()
{
  //  FMR is "reading from freed memory at address 0x%1x  (%d byte%s)"
  int *p = (int*) malloc(sizeof(int));
  free(p);
  printf("p = 0x%h\n",p);
}
FMW
#include <stdlib.h>
int main()
{
  //  FMW is "writing to freed memory at address 0x%1x (%d byte%s)"
  int *p = (int*) malloc(sizeof(int));
  free(p);
  *p = 1;
}
FRP
#include <stdlib.h>
int main()
{
  //  FRP:  freed pointer passed to realloc
  int *p = (int*) malloc(sizeof(int));
  free(0);
  int *q = (int*) realloc(p,sizeof(int[2]));
}
IMR
#include <stdlib.h>
int main()
{
  //  IMR:  read from invalid memory address
  int *p = 0;
  int i = *p;   // generates Signal 11...
}
IMW
#include <stdlib.h>
int main()
{
  //  IMW:  write to invalide memory address
  int *p = 0;
  *p = 1;       // generates Signal 11...
}
PIR
#include <stdio.h>
#include <stdlib.h>
int main()
{
  //  PIR:  accessing partially initialized data
  int *p = (int*) malloc(sizeof(int));
  *((char*)p) = 'c';
  printf("*(p = %d\n",*(p+1));
}  
UAR
#include <stdio.h>
#include <stdlib>
int main()
{
  //  UAR is "reading from unallocated memory"
  int *p = (int*) malloc(sizeof(int));
  printf("*(p+1) = %d\n",*(p+1));
}
UAW
#include <stdio.h>
#include <stdlib.h>
int main()
{
  // UAW is "writing to unallocated memory"
  int *p = (int*) malloc(sizeof(int));
  *(p+1) = 1;
}
UMR
#include <stdio.h>
#include <stdlib.h>
int main()
{
  // UMR is "accessing uninitialized data from address 0x%1x (A%d byte%s)"
  int *p = (int*) malloc(sizeof(int));
  printf("*p = %d\n",*p);
} 

メモリーアクセスの警告

Discover は次のメモリーアクセスの警告を報告します。

次のセクションは、AZS 警告を生成する簡単なプログラム例を一覧表示します。

AZS
#include <stdlib.h>
int main()
{
  //  AZS:  allocating zero size memory block
  int *p = malloc();
}