- 조금 더 조사해보고 다시 써야함 -

libjpeg를 이용하여 jpeg를 변환하는데 다른건 잘되길래
테스트 하기위해 gimp에서 grayscale로 변환하였고, 데이터 상으로는 8bit 이미지로 출력이 되었다.
막상 화면에 뿌리려고 보니 기본 루틴이 24bit라서 이상하게 나오는데,
나오는 모습을 보니 묘하다고 해야 하나.. 아무튼 grayscale이니 1byte 단위로  gray만 출력하는 것으로 보인다.

그런데.. 흑백 bitmap은 구조가 어떻게 되려나?


jpg(좌) bmp(우)


회색 이미지는 GIMP에서 jpg를 grayscale로 변환후, bmp로 저장한 것이다.
이 파일 내용을 보니, 헤더 다음에 위와 같이 000 111 222 이런 식으로 반복되는 것이 있는데,
bitmap은 별도의  grayscale이 존재하는 것이 아니라, 256 indexed color로 저장이되며, 결국 "팔레트로 표현"이 된다.

Posted by 구차니
프로그램 사용2009. 7. 3. 11:55
개인적으로 가장 마음에 드는 변화는 탭에 +가 생겼다는 겁니다!!!
예전에 잠시 크롬을 사용할 때 부러웠던 부분이었는데 말이죠 ㅋ


아무튼 현재까지 가장 마음에 드는 부분입니다 +_+!
(이전 버전에는 탭 우클릭 새 탭/ 혹은 Ctrl-t를 했어야 했는데 말이죠)
Posted by 구차니
$ more hello.c
#include <unistd.h>

int flag = 0;

void aa()
{
        sleep(1);
}

void bb()
{
        sleep(1);
}

void tt()
{
        if(flag^=1)
                aa();
        else    bb();
}

void main()
{
        int test;
        char str[] = "Hello World!";
        for(test = 0; test < 100; test++)
        {
                printf("Hello World!\n");
                tt();
        }
        test = 1 + 1;

}

위의 소스를
$ gcc -g -o a.out hello.c
로 디버깅이 가능하도록 컴파일을 해준다.

그리고
$ gdb a.out
으로 디버깅을 시작한다.

아무튼~ step과 next 라는 명령어가 있는데
비슷하면서도 다른 역활을 한다.


29                      tt();
(gdb) step
tt () at hello.c:17
17              if(flag^=1)
(gdb) l
12              sleep(1);
13      }
14
15      void tt()
16      {
17              if(flag^=1)
18                      aa();
19              else    bb();
20      }
21
(gdb) next
18                      aa();
(gdb) next
20      }
(gdb)


일단 step은 말그대로 한단계 나아가고, 함수를 만나면 함수 안으로 들어간다. (비쥬얼 스튜디오의 F11)
그리고 next는 다음 줄로 나아가므로, 함수를 만나면 함수 다음줄로 넘어간다. (비쥬얼 스튜디오의 F10)

그리고 어셈블리 레벨에서 진행하려면 ni / si (instruction) 을 입력하면 된다.
Posted by 구차니
gdb 내부 명령어 모음집

가장 눈여겨 볼 만한 부분은
help breakpoints
help running
help stack
으로

gdb에서 한줄 실행, 함수 들어가기, 나가기 등은 running에
함수 불려진 순서등의추적은 stack에
브레이크 포인트 생성/삭제는 breakpoints의 항목에 들어 있다.

일단 Visual Studio에서 많이 쓰는것들로

브레이크 포인트 설정은 break 와 delete breakpoints 이다. (F8)
(gdb) help break
Set breakpoint at specified line or function.
break [LOCATION] [thread THREADNUM] [if CONDITION]
LOCATION may be a line number, function name, or "*" and an address.
If a line number is specified, break at start of code for that line.
If a function is specified, break at start of code for that function.
If an address is specified, break at that exact address.
With no LOCATION, uses current execution address of selected stack frame.
This is useful for breaking on return to a stack frame.

THREADNUM is the number from "info threads".
CONDITION is a boolean expression.

Multiple breakpoints at one place are permitted, and useful if conditional.

Do "help breakpoints" for info on other commands dealing with breakpoints.
--------------------------------------------------------------------------------
(gdb) help delete breakpoints
Delete some breakpoints or auto-display expressions.
Arguments are breakpoint numbers with spaces in between.
To delete all breakpoints, give no argument.
This command may be abbreviated "delete".

그리고 한줄 실행은 next(행단위 실행 F10) / step(함수단위 실행 F11) 으로
원하는 곳까지 실행은 breakpoint를 잡은후 continue를 하면 된다.

(gdb) help next
Step program, proceeding through subroutine calls.
Like the "step" command as long as subroutine calls do not happen;
when they do, the call is treated as one instruction.
Argument N means do this N times (or till program stops for another reason).

(gdb) help step
Step program until it reaches a different source line.
Argument N means do this N times (or till program stops for another reason).

(gdb) help jump
Continue program being debugged at specified line or address.
Give as argument either LINENUM or *ADDR, where ADDR is an expression for an address to start at.

gdb의 차이점은, 현재 실행중인 라인을 보기가 조금은 힘들다는 것인데,
소스를 보기 위해서는 list를 입력하면 된다.
(gdb) help list
List specified function or line.
With no argument, lists ten more lines after or around previous listing.
"list -" lists the ten lines before a previous ten-line listing.
One argument specifies a line, and ten lines are listed around that line.
Two arguments with comma between specify starting and ending lines to list.
Lines can be specified in these ways:
  LINENUM, to list around that line in current file,
  FILE:LINENUM, to list around that line in that file,
  FUNCTION, to list around beginning of that function,
  FILE:FUNCTION, to distinguish among like-named static functions.
  *ADDRESS, to list around the line containing that address.
With two args if one is empty it stands for ten lines away from the other arg.




Posted by 구차니
gdb는 GNU DeBugger 이고
gdbserver는 타겟보드나 원격지의 시스템을 디버깅하는데 쓰이는 서버 프로그램이다.
insight는 위의 것을 통괄적으로 사용하는 GUI 툴이다.



일단 (실패는 했지만) 간단하게 설명하자면

개발 타겟 보드에서, 프로그램 실행시에
1. gdbserver localhost:port program 으로 실행한다.
port는 딱히 정해진 well-known port가 없으므로, 임의로 설정을 하면되는 것으로 보인다.

서버측에서는
2. gdb program으로 실행한다.
3. gdb가 구동하면 target remote ipaddr:port 로 접속한다.
4. 그 다음에는 gdb 사용하듯 사용하면 된다.


insight는 사용을 해보기에는, gdb를 내장하고 있는것으로 보이며

1. File 메뉴의 Target Setting 항목에서

2. 원하는 방법을 고른 후 설정한다.

3. 나의 경우에는 시리얼에는 각종 디버그 메시지로 인해서 맘편하게 TCP로 하기로 했으니..
   아무튼 Hostname은 Target 보드의 IP, 포트는 gdbserver에서 설정했던 포트를 사용하면 된다.

크로스컴파일 실패로 실질적으로 디버깅은 불가 ㅠ.ㅠ

'프로그램 사용 > gdb & insight' 카테고리의 다른 글

gdb 명령어 - next / step / [엔터]  (0) 2009.07.01
gdb help  (0) 2009.06.26
gdb/insight configure 도움말  (0) 2009.06.26
GDB Insight FAQ - support target list  (0) 2009.06.26
insight - GDB GUI frontend  (0) 2009.06.26
Posted by 구차니
$ ./configure --help
`configure' configures this package to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR           user executables [EPREFIX/bin]
  --sbindir=DIR          system admin executables [EPREFIX/sbin]
  --libexecdir=DIR       program executables [EPREFIX/libexec]
  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
  --libdir=DIR           object code libraries [EPREFIX/lib]
  --includedir=DIR       C header files [PREFIX/include]
  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
  --infodir=DIR          info documentation [PREFIX/info]
  --mandir=DIR           man documentation [PREFIX/man]

Program names:
  --program-prefix=PREFIX            prepend PREFIX to installed program names
  --program-suffix=SUFFIX            append SUFFIX to installed program names
  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names

System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
  --target=TARGET   configure for building compilers for TARGET [HOST]

Optional Features:
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-libada         build libada directory
  --enable-libssp         build libssp directory
  --enable-stage1-languages[=all]   choose additional languages to build during
                          stage1.  Mostly useful for compiler development.
  --enable-objc-gc        enable use of Boehm's garbage collector with the
                          GNU Objective-C runtime
  --enable-bootstrap      enable bootstrapping [yes if native build]
  --enable-serial-[{host,target,build}-]configure
                          force sequential configuration of
                          sub-packages for the host, target or build
                          machine, or all sub-packages
  --enable-maintainer-mode enable make rules and dependencies not useful
                          (and sometimes confusing) to the casual installer
  --enable-stage1-checking[=all]   choose additional checking for stage1
                          of the compiler
  --enable-werror         enable -Werror in bootstrap stage2 and later

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-build-libsubdir=DIR  Directory where to find libraries for build system
  --with-mpfr-dir=PATH    this option has been REMOVED
  --with-mpfr=PATH        specify prefix directory for installed MPFR package.
                          Equivalent to --with-mpfr-include=PATH/include
                          plus --with-mpfr-lib=PATH/lib
  --with-mpfr-include=PATH
                          specify directory for installed MPFR include files
  --with-mpfr-lib=PATH    specify directory for the installed MPFR library
  --with-gmp-dir=PATH     this option has been REMOVED
  --with-gmp=PATH         specify prefix directory for the installed GMP package.
                          Equivalent to --with-gmp-include=PATH/include
                          plus --with-gmp-lib=PATH/lib
  --with-gmp-include=PATH specify directory for installed GMP include files
  --with-gmp-lib=PATH     specify directory for the installed GMP library
  --with-build-sysroot=SYSROOT
                          use sysroot as the system root during the build
  --with-debug-prefix-map='A=B C=D ...'
                             map A to B, C to D ... in debug information
  --with-build-time-tools=PATH
                          use given path to find target tools during the build
  --with-datarootdir      use datarootdir as the data root directory.
  --with-docdir           install documentation in this directory.
  --with-pdfdir           install pdf in this directory.
  --with-htmldir          install html in this directory.

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
              headers in a nonstandard directory <include dir>
  CXX         C++ compiler command
  CXXFLAGS    C++ compiler flags
  AR          AR for the host
  AS          AS for the host
  DLLTOOL     DLLTOOL for the host
  LD          LD for the host
  LIPO        LIPO for the host
  NM          NM for the host
  RANLIB      RANLIB for the host
  STRIP       STRIP for the host
  WINDRES     WINDRES for the host
  WINDMC      WINDMC for the host
  OBJCOPY     OBJCOPY for the host
  OBJDUMP     OBJDUMP for the host
  CC_FOR_TARGET
              CC for the target
  CXX_FOR_TARGET
              CXX for the target
  GCC_FOR_TARGET
              GCC for the target
  GCJ_FOR_TARGET
              GCJ for the target
  GFORTRAN_FOR_TARGET
              GFORTRAN for the target
  AR_FOR_TARGET
              AR for the target
  AS_FOR_TARGET
              AS for the target
  DLLTOOL_FOR_TARGET
              DLLTOOL for the target
  LD_FOR_TARGET
              LD for the target
  LIPO_FOR_TARGET
              LIPO for the target
  NM_FOR_TARGET
              NM for the target
  OBJDUMP_FOR_TARGET
              OBJDUMP for the target
  RANLIB_FOR_TARGET
              RANLIB for the target
  STRIP_FOR_TARGET
              STRIP for the target
  WINDRES_FOR_TARGET
              WINDRES for the target
  WINDMC_FOR_TARGET
              WINDMC for the target

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

일단 컴파일 걸어 놓으러 -ㅁ-

아래는 insight 컴파일


크로스컴파일을 거는데 여전히 이상하게 작동을 하는 insight T.T

일단 실행시키면
$ ./gdb/insight

warning: A handler for the OS ABI "GNU/Linux" is not built into this configuration
of GDB.  Attempting to continue with the default sh settings.
라는 경고가 발생을 하고, sh4로 컴파일 된 녀석을 해보려고 하면


라는 경고를 출력한다. 당췌.. 어떻게 하란건지 모르겠네..

ABI는 Application Binary Interface의 약자라고 한다.
[출처 : http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/gdb/abi.html]

'프로그램 사용 > gdb & insight' 카테고리의 다른 글

gdb help  (0) 2009.06.26
간단한 gdb/gdbserver/insight 사용법  (0) 2009.06.26
GDB Insight FAQ - support target list  (0) 2009.06.26
insight - GDB GUI frontend  (0) 2009.06.26
gdb야 좀 대충 속아라~ 응?! 아 쫌!  (6) 2009.06.18
Posted by 구차니
FAQ를 찾다가 대략 좌절

2.3 How do I know what targets are supported by Insight?

There is no definitive list of targets supported by each version of GDB/Insight. The best place to look to find out if your target is supported is in the configure script and the source tree of the particular version of insight you are using.

-> 번역
GDB/Insight의 각 버전별 지원 타겟의 목록은 없습니다. 가장 좋은 방법은 configure 스크립트와 소스를 뒤져보는 수밖에 없습니다. (장난해!!!!)

[링크 : http://sources.redhat.com/insight/faq.php#q-2.2]

아무튼 이미 컴파일되어 있는 sh4-linux-gdb의 경우 실행하면 아래와 같이 나온다.
# sh4-linux-gdb
GNU gdb STMicroelectronics/Linux Base 6.4-12 [build Oct 15 2006]
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=sh4-linux".
(gdb)

근데.. 저렇게 타겟을 바꾸면... insight 자체가 타겟에 맞게 바뀔려나?
아니면 gdb 부분만 sh4-linux-gdb로 교체가 가능한걸려나?

'프로그램 사용 > gdb & insight' 카테고리의 다른 글

간단한 gdb/gdbserver/insight 사용법  (0) 2009.06.26
gdb/insight configure 도움말  (0) 2009.06.26
insight - GDB GUI frontend  (0) 2009.06.26
gdb야 좀 대충 속아라~ 응?! 아 쫌!  (6) 2009.06.18
gdb 한글 문서  (0) 2009.06.18
Posted by 구차니
insight는 GDB를 위한 GUI 프로그램이다.

About 메뉴

웬만한 창은 다 띄워본 화면

insight의 툴바. 순서대로
실행(Run) - 함수안으로(Step) - 함수다음(Next) - 함수나오기(Finish) - 계속실행(Continue)
앞에 5개만 알아도 사용하는데 지장없을 듯 하다.

사용법은 생각보다 단순해서, Visual Studio 에서 디버깅하는 느낌이 들 정도이다.
일단 자세한 사용법은 조금 더 사용해본 뒤 +_+!

[공식 : http://sources.redhat.com/insight/index.php]
[링크 : http://vasudevkamath.blogspot.com/2008/10/gdbs-gui-insight-tutorial.html]


insight를 설치하니, insight의 도움말을 띄우는데 gdb가 나온다.
아무튼 gdb로 실행하기 보다는 그냥 insight로 실행하면 된다.(gdb -w로 하면 된다는데 안된다)
Posted by 구차니
프로그램 사용2009. 6. 24. 18:28
증상 : 편집할 파일을 여는데 symbol window가 자동으로 열리지 않는 경우

아무생각없이 메뉴를 클릭한 상태에서 소스작업을 하다가 키를 연타로 누르는 바람에
창이 사라져서 어느창에서 변경되었는지 알수도 없고, 근 일주일간 해결책을 찾다가 포기한 상태에서
우연히 다시 찾게된 해결책이다. OTL

교훈 : 마우스는 안전한 곳에!


Step 1.
Option - Document Options 를 연다.

Step 2.
우측 하단의 Symbol Window의 체크를 켜준다.


Posted by 구차니
프로그램 사용2009. 6. 22. 14:12
ZOC Terminal은 Shareware이다(탈락!!!)


[링크 : http://www.fileguru.com/ZOC-Terminal/info]



은근히 Freeware로 탭 지원되는 터미널 에뮬레이터가 없다는 사실에 놀랐다 -ㅁ-
음... CSerial도 여러개의 인스턴스를 사용할 수 있다면 간단하게 구현이 가능할텐데..
한번 공부할 겸 시간내서 만들어 볼까나?
Posted by 구차니