리눅스 gdb에서 \x를 문자로 인식 안하고 16진수로 입력하고 싶습니다.

cg3980의 이미지

간단한 시스템해킹 예제 문제를 보고 있는데요
c code로 작성된 프로그램입니다.

입력으로 r \x01\x01\x01\x01을 입력하고 레지스터에 입력된 값을 보면 당연히 메모리에
0x01010101로 입력될 줄 알았더니
0x3130785c 0x3130785c 0x3130785c 0x3130785c
이렇게 입력이 돼 있네요(문자 그대로 10x\ 이런식으로 입력이 되어버림)

당연히 \x01로 입력을 하면 0x01로 입력될줄 알았는데 제가 실수한 건가요?

shint의 이미지

비슷한 질문이 있네요.

How to make gdb print out all values in hexadecimal mode?
https://stackoverflow.com/questions/6618670/how-to-make-gdb-print-out-all-values-in-hexadecimal-mode

set output-radix 16 (and set output-radix 10 to switch it back).

How to make gdb print out all values in hexadecimal mode?

By default, gdb always prints/displays all variables / arguments in base 10. Is there any way to ask gdb to always use base 16 while printing anything (and turn back to default settings when I don't need that) ? I know that it can be printed by supplying the '/x' argument to print/display, but I don't want to do it everytime....

gdb가 모든 값을 16 진수 모드로 출력하도록 만드는 방법?

기본적으로 gdb는 항상 기본 10의 모든 변수 / 인수를 인쇄 / 표시합니다. 아무 것도 인쇄하는 동안 기본 16을 사용하도록 gdb에 요청하는 방법이 있습니까? (필요하지 않을 때 기본 설정으로 되돌립니다)? 인쇄 / 표시에 '/ x'인수를 제공하여 인쇄 할 수 있다는 것을 알고 있지만 매번 그것을하고 싶지는 않습니다 ....

DEBUGGING WITH GDB
https://azeria-labs.com/debugging-with-gdb-introduction/

Change input base in shell script with dc?
https://stackoverflow.com/questions/7772853/change-input-base-in-shell-script-with-dc

echo 100 2i p | dc
echo 16i DEADBEEF 10o p 2o p | dc # but see below

gdb의 print 명령
http://manime.tistory.com/entry/gdb의-print-명령

----------------------------------------------------------------------------
젊음'은 모든것을 가능하게 만든다.

매일 1억명이 사용하는 프로그램을 함께 만들어보고 싶습니다.
정규 근로 시간을 지키는. 야근 없는 회사와 거래합니다.

각 분야별. 좋은 책'이나 사이트' 블로그' 링크 소개 받습니다. shintx@naver.com