expat은 아래와 같은 기본 코드로 작동된다. (링크 참조)
2010/03/23 - [프로그램 사용/expat / XML] - expat-2.0.1 example

문제는 위의 main() 함수에서 fread()를 이용하여 버퍼 사이즈 만큼 읽어오기 때문에
최악의 경우 데이터나 elemet가 잘리는 경우가 발생할수 있다는 것이다.
예를 들어

<entry gd:etag="W/"CUQFRX47eCp7ImA9WxFXF0s."">
    <id>tag:youtube.com,2008:video:qlZjYvHWTo4</id>
    <published>2010-05-19T07:13:31.000Z</published>
    <updated>2010-05-25T04:55:14.000Z</updated>
</entry>

이러한 XML이 있고, "id" 태그의 데이터를 읽으려고 할때 최악의 경우
버퍼의 경계에 걸릴경우,
tag:youtube.com,2008:vide
o:qlZjYvHWTo4
이런식으로 두번을 읽어 오게 된다.

일단은 버퍼를 늘리는 것 외에는 딱히 다른 방법은 찾지 못했다.

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

GPX TCX 포맷  (0) 2013.06.22
Javascript DOM API / XML  (2) 2010.07.13
expat으로 smi 자막파일 파싱은 불가?  (0) 2010.05.03
SAX (Simple API for XML)  (0) 2010.04.23
xml 트리 탐색 - XML tree navigation  (0) 2010.04.17
Posted by 구차니
결론만 간단히 내자면, insight 컴파일시 환경설정에 따라서, target/TCP target/Serial이 추가된다.
그러니 신경쓰지 말고
GDBServer/TCP 나 Remote/TCP 둘중에 하나 골라서 쓰면된다.



Selecting a Target
Selecting a target involves choosing a target for debugging and setting connection interface options for the target.

Common targets include: "Exec" for native debuggers, "Remote/Serial" for establishing a connection to a target board via a serial line, "Remote/TCP" for TCP connections, and "Simulator" for connections to the simulator. There may be more depending on the configuration of the debugger being used.

In general, "remote" targets are always serial connections which require the user to specify the serial port and baud rate to be used for the connection and "remote/tcp" targets are always TCP connections which require specifying the hostname and port number of the machine to which to connect. Depending upon configuration, there may be numerous serial- and TCP-based connections. These always follow the naming convention target/Serial and target/TCP.

To select a target, choose one of the available targets from the dropdown menu in the Connection Frame. Then specify the interface options for this target: selecting the baudrate and serial port from the dropdown menus (serial targets only) or entering the hostname and port number (TCP targets only).

[출처 : insight - About GDB - target window]


Posted by 구차니
우분투에서 insight 소스를 받아서 컴파일 하는데 에러를 뱉어낸다 ㄱ-

WARNING: `makeinfo' is missing on your system.  You should only need it if
         you modified a `.texi' or `.texinfo' file, or any other file
         indirectly affecting the aspect of the manual.  The spurious
         call might also be the consequence of using a buggy `make' (AIX,
         DU, IRIX).  You might want to install the `Texinfo' package or
         the `GNU make' package.  Grab either from any GNU archive site.

$ makeinfo
'makeinfo' 프로그램은 현재 설치되어 있지 않습니다.  다음을 입력하여 이를 설치할 수 있습니다:
sudo apt-get install texinfo
머.. texinfo 패지키를 깔면 해결된다.

그리고, make distcelan 이후 다시 configure를 하고 해주니, 요런 에러가 발생한다.
configure: error: no termcap library found
이녀석은 libncurses5-dev 패키지를 설치하면 해결된다.
[링크 : http://leoric99.tistory.com/entry/Ubuntutermcap-라이브러리-해결-방법]

그런데.. 이 에러는 도대체 어떻게 잡아야 하나...
gcc -c -g -O2   -I. -I.././gdb -I.././gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I.././gdb/../include/opcode -I.././gdb/../readline/.. -I../bfd -I.././gdb/../bfd -I.././gdb/../include -I../libdecnumber -I.././gdb/../libdecnumber   -DMI_OUT=1 -DGDBTK -DTUI=1  -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wno-switch -Wno-char-subscripts -Werror linux-nat.c
cc1: warnings being treated as errors
linux-nat.c: In function ‘linux_nat_info_proc_cmd’:
linux-nat.c:2879: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
gdb/Makefile 에서 -Werror 부분을 주석처리 해준다.

WARNING: `bison' missing on your system.  You should only need it if
         you modified a `.y' file.  You may need the `Bison' package
         in order for those modifications to take effect.  You can get
         `Bison' from any GNU archive site.
머.. bison 패키지를 깔면 해결된다.

ada-lex.c missing and flex not available.
... 정말로 파일이 없다.
일단 flex 패키지를 설치해준다.
[링크 : http://kldp.org/node/55249]

그런데.. 또 클린하고 해도..
gcc -g -O2      \
                -o gdb gdb.o libgdb.a \
                   ../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libbfd.a  ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a    ../libgui/src/libgui.a -L/home/morpheuz/src/insight/itcl/itcl -litcl3.2 -L/home/morpheuz/src/insight/itcl/itk -litk3.2 -L/home/morpheuz/src/insight/tk/unix -ltk8.4 -Wl,-rpath,/usr/local/lib -L/home/morpheuz/src/insight/tcl/unix -ltcl8.4   -lX11 -ldl  -lieee -lm -lncurses -lm   ../libiberty/libiberty.a  -ldl -rdynamic
libgdb.a(ada-lang.o): In function `parse':
/home/morpheuz/src/insight/gdb/ada-lang.c:10972: undefined reference to `ada_parse'
libgdb.a(ada-lang.o):(.rodata+0xda0): undefined reference to `ada_error'

... ada 가 날 열받게 하는구나~ ㄱ-
아놔 안해안해 ㄱ-


+
2016.08.29
[링크 : http://decdream.tistory.com/370] 이분은 성공하셨네 ㅠㅠ


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

gdb break  (0) 2021.04.09
gdb/insight target window  (0) 2010.05.19
gdb / gdbserver 접속명령어  (0) 2010.05.18
insight(gdb) 아키텍쳐별 차이점(?)  (0) 2010.05.18
gdb cross compile 관련  (0) 2010.05.18
Posted by 구차니
gdbserver는 gdb를 돌릴만한 사정이 안되는 시스템을 위한 프로그램으로
단순하게 gdb의 앞단에서 데이터를 TCP나 시리얼 등으로 전송해 주는 역활을 한다.
그런 이유로 gdbserver 만으로는 아무런 것도 할수 없으며

크로스 컴파일 환경이라면, 내부적으로 크로스 환경에 맞추어진 gdb가 별도로 존재해야 한다.
gdbserver는 아래와 같이 host:port 식으로 선언을 하는데 현재까지는 host는 무시를 하고 port만을 받아들인다고 한다.

To use a TCP connection instead of a serial line:

     target> gdbserver host:2345 emacs foo.txt

The only difference from the previous example is the first argument, specifying that you are communicating with the host gdb via TCP. The `host:2345' argument means that gdbserver is to expect a TCP connection from machine `host' to local TCP port 2345. (Currently, the `host' part is ignored.)

[링크 : http://sourceware.org/gdb/current/onlinedocs/gdb/Server.html#Server]

그리고 gdb 쪽에서는 target remote 라는 명령어를 통해 접속이 가능하며, 기본값으로는 TCP로 접속하도록 되어있다.

target remote host:port
target remote tcp:host:port
    Debug using a TCP connection to port on host. The host may be either a host name or a numeric IP address; port must be a decimal number. The host could be the target machine itself, if it is directly connected to the net, or it might be a terminal server which in turn has a serial line to the target.

target remote udp:host:port
    Debug using UDP packets to port on host. For example, to connect to UDP port 2828 on a terminal server named manyfarms:
              target remote udp:manyfarms:2828
    When using a UDP connection for remote debugging, you should keep in mind that the `U' stands for “Unreliable”. UDP can silently drop packets on busy or unreliable networks, which will cause havoc with your debugging session.

[링크 : http://sourceware.org/gdb/current/onlinedocs/gdb/Connecting.html#Connecting]


음.. 그런데 gdb/insight 에서 보이는
GDBserver/TCP , remote/TCP는 멀까?
Posted by 구차니
테스트 환경
SH4 target board / i686 linux machine

아래의 화면은
./configure --build=i686-linux --host=i686-linux --target=sh4-linux
옵션으로 크로스컴파일된 insight의 Run 메뉴화면이다.


아래의 화면은
./configure
옵션으로 i686용으로 컴파일된 insight의 Run 메뉴화면이다.


음.. 크로스 컴파일 된녀석만 메뉴상에 별도로 Connect to target이 생기고
로컬용으로 컴파일 된녀석은 메뉴상에 Attach to process가 생기는 것으로 보인다.


About GDB 다이얼로그 차이점

<< sh4 , i686 >>
About 다이얼로그의 내용은 gdb 에서 show version으로 나오는 정보이며

가장 아래줄의
This GDB was configured as "i686-pc-linux-gnu".
This GDB was configured as "--host=i686-linux --target=sh4-linux".
만 다르게 나온다.


Attach to Process 메뉴화면

Posted by 구차니
검색을 해보니, arm 용으로 크로스 컴파일 하는 문서가 있다.

# ./configure --build=i686-linux --host=arm-linux --target=arm-linux --prefix=/nfsroot/gdb
# ./configure --build=i686-linux --host=i686-linux --target=arm-linux --prefix=$PWD/build
[링크 : http://blog.daum.net/joell/11772014]

일단 gdb는 두번을 컴파일 해야 한다.
target 에서 native 하게 돌아갈 gdb와 (위)
host 에서 target architecture에 맞추어 돌아갈 gdb. (아래)

그리고 prefix 경로는 /usr 을 넣어주는게 좋을듯 하다. (설치를 하면서 보니 prefix가 usr 경로를 의미하는 것으로 보인다)

--- gdb/gdbserver
# ./configure --build=i686-linux --host=sh4-linux --target=sh4-linux --prefix=/home/morpheuz/st7109/target
# make
# make install
n=`echo gdbserver | sed 's,^,sh4-linux-,'`; \
        if [ x$n = x ]; then n=gdbserver; else true; fi; \
        /bin/sh ./../../mkinstalldirs /home/morpheuz/st7109/target/bin; \
        /usr/bin/install -c gdbserver /home/morpheuz/st7109/target/bin/$n; \
        /bin/sh ./../../mkinstalldirs /home/morpheuz/st7109/target/man/man1; \
        /usr/bin/install -c -m 644 ./gdbserver.1 /home/morpheuz/st7109/target/man/man1/$n.1

Posted by 구차니
드물게(?) 크로스컴파일을 시도하려다 다시 지우고 컴파일을 하려고 하면 안되는 경우가 있다.
아래는 gdb/insight의 경우인데, 특이하게도 하라는대로 해도 안된다. ㄱ-

configure: loading cache ./config.cache
configure: error: `target_alias' has changed since the previous run:
configure:   former value:  sh4-linux
configure:   current value: i686-pc-linux-gnu
configure: error: changes in the environment can compromise the build
configure: error: run `make distclean' and/or `rm ./config.cache' and start over

이녀석은 make distclean 해도 하위 디렉토리의 config.cache를 개별로 지우지 않기 때문이다.
(음... 알려줘서 원 소스에 넣도록 해야하나?)

미봉책으로는
# make distclean
# find ./ -name config.cache -exec {} \;
를 하면 하위 디렉토리에서 config.cache를 찾아 지우므로 해결된다.

'프로그램 사용 > make, configure' 카테고리의 다른 글

make를 조용하게  (0) 2014.09.12
cmake 사용  (0) 2011.10.07
cmake - cross make  (0) 2010.04.06
makefile 에서 컴파일할 목록 생성하기  (0) 2010.04.03
makefile 정렬하기  (2) 2010.03.31
Posted by 구차니

예전에는(불과 한달전!) content가 feed - content 였는데 이제는 바뀌어서
feed - media:group - media:description에 들어있다.

2010/04/09 - [프로그램 사용/유튜브(youtube)] - youtube xml / RSS 주소

Posted by 구차니
구버전의 Portable Ubuntu를 쓰시는분은 신버전인
Portable Ubuntu Remix version TRES로 갈아 타시기 바랍니다!

Thursday, April 1st, 2010

Portable Ubuntu Remix version TRES released!

Changes:

  • Ubuntu 9.10 (Karmin Koala).
  • Colinux 0.80 (Kernel 2.6.33).
  • Root filesystem with 3.7 Gb.
  • Cygwin 1.7.
  • Cygwin/X.
  • Fixed configuration of the keyboard layout.
  • Optative graphics effects.
  • Fixed init scripts.

[링크 : http://portableubuntu.demonccc.com.ar/en/news]

제가 사용하던 구버전인 8.10(?) 의 경우
켜지는데 60초(1분)
꺼지는데 14초가 걸린 반면

TRES의 경우 (9.10)
켜지는데 26초
꺼지는데 5초가 걸렸습니다.


ㅆㅂ 이거슨 혁명이여 ㄱ-



사족 : 테스트 플랫폼 [센트리노 1.2Ghz / 1GB / TC-1100]
Posted by 구차니
smi 파일을 파싱할일이 생겨서 대충 훑어 보는데
아무리 봐도 열고닫기가 잘안되있어서 안될꺼 같았는데

의외로 엉뚱한 부분에서 진행이 안된다.

$ ./smi.o
not well-formed (invalid token) at line 9

<SAMI>
<HEAD>
<Title> Produced by CCMP produced by CineCaption </Title>
<STYLE TYPE="text/css">
<!--
P { margin-top:2pt; margin-bottom:2pt; margin-left:8pt; margin-right:8pt;
    text-align:center;
    font-size:20pt; font-family:arial, sans-serif; font-weight:normal; color:white; }
.KRCC { Name:한글; lang:ko-KR; SAMIType:CC;}
.ENCC { Name:영어; lang:en-US; SAMIType:CC;}
#STDPrn { Name:보통;}
#LargePrn { Name:크게; font-size:25pt;}
#SmallPrn { Name:작게; font-size:15pt;}
-->
</Style>

9 line은 .KRCC 라는 부분인데 시작부터 막히는구나.. ㅠ.ㅠ
Posted by 구차니