é–¢•°‘¼‡¾‌­‚°ƒ©ƒ•‚’用„...

download é–¢•°‘¼‡¾‌­‚°ƒ©ƒ•‚’用„ ƒ©‚¤ƒ–ƒ©ƒ®ç”¨¾‹¤œç´¢

of 16

  • date post

    25-Jan-2016
  • Category

    Documents

  • view

    33
  • download

    3

Embed Size (px)

description

関数呼出依存グラフを用いた ライブラリの用例検索. 名古屋大学 工学研究科 計算理工学専攻 阿草研究室 渥美 紀寿. 背景. 高級言語ではライブラリが提供 入出力,文字列操作,整列操作等 ライブラリの知識が必要 マニュアルの参照 既存のソースコードから文字列検索. プログラム中に多くの ライブラリ が使用される. マニュアルの参照. (例)ライブラリ関数 connect 第一引数に関する説明. - PowerPoint PPT Presentation

Transcript of é–¢•°‘¼‡¾‌­‚°ƒ©ƒ•‚’用„...

  • sSOCK_DGRAM SOCK_STREAM connectsocket

  • finger/net.c: if (Tflag && connect(s, (struct sockaddr *)&sin, ftp/cmds.c: disconnect(0, 0);ftp/fetch.c: if (connect(s, res->ai_addr, res->ai_addrlen) < 0) {ftp/fetch.c: disconnect(0, NULL);ftp/fetch.c: disconnect(0, NULL); if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) { perror("finger: socket"); return; } if (Tflag && connect(s, (struct sockaddr *)&sin, sizeof (sin))) { perror("finger: connect"); return; }

  • FCDG

  • f g g ( , f ( ), ) ; a = f ( ) ; ; g ( , a , ) ;

    a = f(); if (a == NULL) { ... }f g f

  • c f if ( c ) { f( );}while ( c ) { f ( );}c f

  • a = f ( ) ; g ( &a ) ; a = f ( ) ; g ( *a ) ;A.a = f ( ) ; g ( A.a ) ;A.a = f ( ) ; g ( A ) ;A = f ( ) ; g ( A.a) ;a [ i ] = f ( ) ; g ( a [ i ] ) ;a [ i ] = f ( ) ; g ( a ) ;a = f ( ) ; g (a [ i ] ) ;

  • FCDG

  • FCDGfp = fopen( ... );if (fp = = NULL) { fprintf( ... ); exit( ... );}fclose(fp);fopen= =NULLfprintfexitfclosett

  • FCDG= =NULL= =NULLfprintfexitfclosefclose= =NULLfopenfopenfprintfexitttfp = fopen( ... );if (fp = = NULL) { fprintf( ... ); exit( ... );}fclose(fp);

  • FCDGfp = fopen( ... );if (fp = = NULL) { fprintf( ... ); exit( ... );}fclose(fp);fopen= =NULLfprintfexitfclosett

  • FCDGfp = fopen(test, r);if (fp = = NULL) { fprintf(stderr, Cant open file!\n); exit(EXIT_FAILURE);}c = fgetc(fp);while (c != EOF) { putchar(c);}fclose(fp);

  • FCDGfp = fopen(test, r);if (fp = = NULL) { fprintf(stderr, Cant open file!\n); exit(EXIT_FAILURE);}c = fgetc(fp);while (c != EOF) { putchar(c);}fclose(fp);

  • FCDGfp = fopen(test, r);if (fp = = NULL) { fprintf(stderr, Cant open file!\n); exit(EXIT_FAILURE);}c = fgetc(fp);while (c != EOF) { putchar(c);}fclose(fp);

  • FCDGfp = fopen(test, r);if (fp = = NULL) { fprintf(stderr, Cant open file!\n); exit(EXIT_FAILURE);}c = fgetc(fp);while (c != EOF) { putchar(c);}fclose(fp);

  • FCDGfp = fopen(test, r);if (fp = = NULL) { fprintf(stderr, Cant open file!\n); exit(EXIT_FAILURE);}c = fgetc(fp);while (c != EOF) { putchar(c);}fclose(fp);

  • FCDGfopen= =NULL!=EOFfprintfexitputcharfgetcfclosettt

  • if ((a = b) value) {

    }a = b;if ( a value) {

    }switch ((a = b) value) {

    }a = b;switch ( a value) {

    }

  • for (...; (a = b) value; ...) {

    }a = b;for (...; a value; ...) {

    a = b;}do {

    } while ((a = b) value);do {

    a = b;} while (a b);while ((a = b) value) {

    }a = b;while (a value) {

    }

  • FCDGFCDG

  • FCDGFCDG

  • FCDGfopenFCDG(fopen, !=NULL)(fopen, fclose)fopenfseekfclosegetcputchar!=NULL!=EOF! =0ttgetc!=EOFputcharfopenfclose!=NULL

  • FCDGFCDGFCDGFCDG

  • $1 = fopen();if ($1 = = NULL) { perror(); exit();}fclose($1);offset 102offset 115offset 130offset 141offset 165

  • offsetfile

  • FCDGFCDGFCDG

  • FCDG

  • FCDGFreeBSD 4.3-STABLE/usr/binfopen