태터데스크 관리자

도움말
닫기
적용하기   첫페이지 만들기

태터데스크 메시지

저장하였습니다.
블로그 이미지
하늘을 헤엄치다. revoman

카테고리

분류 전체보기 (176)
Eye (13)
Programming (82)
Unix & Linux (52)
Android (3)
Tool and Tip (13)
시스템 관리 (7)
OPEN SOURCE (2)
XML (1)
WEB (0)
MY PROGRAM (1)
정보관리기술사 기출.. (1)
IT 동향 (1)
Total56,866
Today6
Yesterday34

'unix commands'에 해당되는 글 5건

  1. 2007/10/30 [nm] command
  2. 2007/10/30 [ar] command
  3. 2007/10/19 [LINK] 한페이지 Unix 명령어 요약
  4. 2007/10/19 운영체제별 UNIX 명령어 비교표
  5. 2007/10/19 [tar] command

nm

 

Name

       nm - list symbols from object files

Synopsis

       nm [-a│--debug-syms] [-g│--extern-only]
          [-B] [-C│--demangle[=style]] [-D│--dynamic]
          [-S│--print-size] [-s│--print-armap]
          [-A│-o│--print-file-name][--special-syms]
          [-n│-v│--numeric-sort] [-p│--no-sort]
          [-r│--reverse-sort] [--size-sort] [-u│--undefined-only]
          [-t radix│--radix=radix] [-P│--portability]
          [--target=bfdname] [-fformat│--format=format]
          [--defined-only] [-l│--line-numbers] [--no-demangle]
          [-V│--version] [-X 32_64] [--help]  [objfile...]

 

Description

       GNU  nm  lists  the symbols from object files objfile....  If no object
       files are listed as arguments, nm assumes the file a.out.
 
       For each symbol, nm shows:
 
       ·   The symbol value, in the radix selected by options (see below),  or
           hexadecimal by default.
 
       ·   The  symbol  type.   At  least the following types are used; others
           are, as well, depending on the object file format.   If  lowercase,
           the symbol is local; if uppercase, the symbol is global (external).
 
           "A" The symbol’s value is absolute, and will not be changed by fur‐
               ther linking.
 
           "B" The symbol is in the uninitialized data section (known as BSS).
 
           "C" The symbol is common.  Common symbols are  uninitialized  data.
               When  linking, multiple common symbols may appear with the same
               name.  If the symbol is defined anywhere,  the  common  symbols
               are treated as undefined references.
 
           "D" The symbol is in the initialized data section.
 
           "G" The symbol is in an initialized data section for small objects.
               Some object file formats permit more efficient access to  small
               data  objects,  such  as  a global int variable as opposed to a
               large global array.
 
           "I" The symbol is an indirect reference to another symbol.  This is
               a GNU extension to the a.out object file format which is rarely
               used.
 
           "N" The symbol is a debugging symbol.
 
           "R" The symbol is in a read only data section.
 
           "S" The symbol is  in  an  uninitialized  data  section  for  small
               objects.
 
           "T" The symbol is in the text (code) section.
 
           "U" The symbol is undefined.
 
           "V" The  symbol  is  a  weak object.  When a weak defined symbol is
               linked with a normal defined symbol, the normal defined  symbol
               is  used with no error.  When a weak undefined symbol is linked
               and the symbol is not defined, the value  of  the  weak  symbol
                becomes zero with no error.
 
           "W" The  symbol  is  a  weak  symbol that has not been specifically
               tagged as a weak object symbol.  When a weak defined symbol  is
               linked  with a normal defined symbol, the normal defined symbol
               is used with no error.  When a weak undefined symbol is  linked
               and  the  symbol  is  not  defined,  the value of the symbol is
               determined in a system-specific manner without error.  On  some
               systems,  uppercase  indicates  that  a  default value has been
               specified.
 
           "-" The symbol is a stabs symbol in an a.out object file.  In  this
               case,  the  next  values printed are the stabs other field, the
               stabs desc field, and the stab type.  Stabs symbols are used to
               hold debugging information.
 
           "?" The symbol type is unknown, or object file format specific.
 
       ·   The symbol name.

nm은 라이브러리, 컴파일된 오브젝트 모듈, 공유 오브젝트 파일, 독립 실행파일등의 바이너리 파일을 검사해서 그 파일 들에 저장된 내용 또는 메타 정보를 표시한다. nm은 디버깅 과정에서 이름 겹침(naming conflict)과 C++ 이름 맹글링(naming mangling) 문제를 해결하거나 모듈의 심볼릭 정보를 확인하는데 사용된다.
nm의 출력은 크게 3개의 열로 되어 있다. 첫번째 열은 심볼 값을, 두번째 열은 심볼 타입을, 세번째 열은 심볼 이름을 나타낸다. 심볼 값은 생략 가능하고, 보통 table offset 값이나 virtual address를 나타낸다. 심볼 타입은 한 글자 알파벳으로 되어 있고, 심볼 이름은 말 그대로 이름을 나타낸다.

* naming mangling : compiler가 함수의 이름을 내부적인 규칙에 의거해서 바꾸는 것

 

Example

  • default

    1. dev@/home/dev/DEV/trunk/libsrc/SYSMON.R090/release:17 % nm tools.o
      00000086 T SM_Get_LL_Match
      000000b0 T SM_Get_Str_Match
      00000000 T SM_Seek_Line
               U atoll
               U fgets
      00000000 b line.3775
      00001000 b match_string.3803
               U strncmp
               U strncpy
  • -l Option

    1. dev@/home/dev/DEV/trunk/libsrc/SYSMON.R090:25 % nm -l sysmon_r
      0804c8c0 r C.0.3262
      0804a8c0 T SM_Destroy_Process_Stat      /home/dev/DEV/trunk/libsrc/SYSMON/process_stat.c:120
      080494c1 T SM_Get_Cpu_Percent   /home/dev/DEV/trunk/libsrc/SYSMON/cpu_stat.c:307
      0804928a T SM_Get_Cpu_Percent_Diff      /home/dev/DEV/trunk/libsrc/SYSMON/cpu_stat.c:252
      08048fc8 T SM_Get_Cpu_Stat      /home/dev/DEV/trunk/libsrc/SYSMON/cpu_stat.c:85
      080490e1 T SM_Get_Cpu_Stat_Diff /home/dev/DEV/trunk/libsrc/SYSMON/cpu_stat.c:191
      08049dce T SM_Get_Disk_Io_Stat  /home/dev/DEV/trunk/libsrc/SYSMON/disk_stat.c:249

 

  • naming conflict
  1. #include <stdio.h>

    int fl(int a)
    {
        return 1;
    }

    int main(int argc, char** argv)
    {
        f1(1);
        return 0;
    }

    dev@/home/dev/tmp:79 % gcc test.c
    /tmp/ccVfreIk.o: In function `main':
    test.c:(.text+0x23): undefined reference to `f1'
    collect2: ld returned 1 exit status

    dev@/home/dev/tmp:80 % gcc -c test.c
    dev@/home/dev/tmp:81 % nm test.o
             U f1
    00000000 T fl
    0000000a T main

이 글은 스프링노트에서 작성되었습니다.

Posted by revoman

ar

Name

       ar - create, modify, and extract from archives

 

Synopsis

       ar [-X32_64] [-]p[mod [relpos] [count]] archive [member...]

 

Description

       The  GNU  ar program creates, modifies, and extracts from archives.  An
       archive is a single file holding a  collection  of  other  files  in  a
       structure  that  makes  it possible to retrieve the original individual
       files (called members of the archive).
 
       The original files’ contents, mode (permissions), timestamp, owner, and
       group  are preserved in the archive, and can be restored on extraction.
 
       GNU ar can maintain archives whose members have names  of  any  length;
       however,  depending  on how ar is configured on your system, a limit on
       member-name length may be imposed for compatibility with  archive  for-
       mats  maintained with other tools.  If it exists, the limit is often 15
       characters (typical of formats related to a.out) or 16 characters (typ-
       ical of formats related to coff).
 
       ar  is  considered  a  binary utility because archives of this sort are
       most often used as libraries holding commonly needed subroutines.
 
       ar creates an index to the symbols defined in relocatable  object  mod-
       ules  in  the  archive  when you specify the modifier s.  Once created,
       this index is updated in the archive whenever ar makes a change to  its
       contents  (save  for  the q update operation).  An archive with such an
       index speeds up linking to the library,  and  allows  routines  in  the
       library  to  call  each  other without regard to their placement in the
       archive.
 
       You may use nm -s or nm --print-armap to list this index table.  If  an
       archive  lacks  the table, another form of ar called ranlib can be used
       to add just the table.
 
       GNU ar is designed to be compatible with two different facilities.  You
       can control its activity using command-line options, like the different
       varieties of ar on Unix systems; or, if you specify the single command-
       line  option -M, you can control it with a script supplied via standard
       input, like the MRI "librarian" program.

 

Example

  •  display

    1. dev@/home/dev/tmp:119 % ar -t libezstat_r.a
      ez_stat_ctl.o
      ez_stat_log.o
      ez_stat_obj.o
      ez_stat_file.o
      ez_stat_util.o
      version.o

     

  • extract

    1. dev@/home/dev/tmp:203 % ar -xv libezstat_r.a
      x - ez_stat_ctl.o
      x - ez_stat_log.o
      x - ez_stat_obj.o
      x - ez_stat_file.o
      x - ez_stat_util.o
      x - version.o

     

  • insert

    1. dev@/home/dev/tmp:206 % ar -rv tmp.a ez_stat_ctl.o ez_stat_log.o
      ar: creating tmp.a
      a - ez_stat_ctl.o
      a - ez_stat_log.o

이 글은 스프링노트에서 작성되었습니다.

Posted by revoman

한글번역 : http://bsdforum.kr/comments.php?DiscussionID=23&amp;page=1#Item_0

원문 : http://fosswire.com/2007/08/02/unixlinux-command-cheat-sheet/

Posted by revoman

참고 사이트 : http://bhami.com/rosetta.html

pdf 파일 : http://bhami.com/unix-rosetta.pdf

이 글은 스프링노트에서 작성되었습니다.

Posted by revoman

tar

  • 기능

파일을 tar 파일로 묶거나 tar 파일을 푼다.

 

  • 문법
  1. tar [OPTION]... [FILE]...

 

  • 설명

 

  • 예제
  1. tar -cvf aaa.tar *    : 현재 디렉토리의 모든 파일을 aaa.tar 로 묶는다.
  2. tar -xvf aaa.tar      : aaa.tar 파일을 현재 디렉토리에 푼다.
  3. tar zcvf aaa.tar.gz * : 현재 디렉토리의 모든 파일을 gz 파일로 압축한다.
  4. tar zxvf aaa.tar.gz   : aaa.tar.gz 파일을 현재 디렉토리에 푼다.

이 글은 스프링노트에서 작성되었습니다.

Posted by revoman

최근에 달린 댓글

최근에 받은 트랙백

글 보관함