LoginSignup
0
0

WSL2で32bitバイナリをビルドー>デバッグする(C言語)

Posted at

インストール

gcc-multilib, g++-multilib, gdb-multiarchをインストールする。

apt install gcc-multilib
apt install g++-multilib
apt install gdb-multiarch

ビルド

-m32を付与すればOK。

gcc -m32 -o hoge hoge.o

デバッグ

アーキテクチャを指定してデバッグ!
デバッグ自体はruすればできるので割愛する。

gdb hoge
(gdb) set architecture  i386

課題

pでp memset(Hoge_area,0,sizeof(Hoge_area))すると
「'at 0x……00' has unknown return type; cast the call to its declared return type」とエラーになる。
この対処はp (int)memset(Hoge_area,0,sizeof(Hoge_area))すれば解決するが、もっと正しい解決方法あると思われる。
分かったら追記するかな…。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0