pi@raspberrypi:~ $ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 9.4 (stretch)
Release: 9.4
Codename: stretch
gcc
pi@raspberrypi:~ $ gcc --version
gcc (Raspbian 6.3.0-18+rpi1+deb9u1) 6.3.0 20170516
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
gdb
pi@raspberrypi:~ $ gdb --version
GNU gdb (Raspbian 7.12-6) 7.12.0.20161007-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
make
pi@raspberrypi:~ $ make --version
GNU Make 4.1
このプログラムは arm-unknown-linux-gnueabihf 用にビルドされました
Copyright (C) 1988-2014 Free Software Foundation, Inc.
ライセンス GPLv3+: GNU GPL バージョン 3 以降 <http://gnu.org/licenses/gpl.html>
これはフリーソフトウェアです: 自由に変更および配布できます.
法律の許す限り、 無保証 です.
main にブレークポイントを入れて(b main )、 動かして(run)、ブレークして、(n)で一行づつ動かす。
pi@raspberrypi:~/testclang/test1 $ gdb ./a.out
GNU gdb (Raspbian 7.12-6) 7.12.0.20161007-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./a.out...done.
(gdb) b main
Breakpoint 1 at 0x10450: file helloworld.c, line 4.
(gdb) run
Starting program: /home/pi/testclang/test1/a.out
Breakpoint 1, main (argc=1, argv=0x7effee24) at helloworld.c:4
4 printf("Hello!\n");
(gdb) n
Hello!
5 printf("World!\n");
(gdb) n
World!
6 };(gdb)
まぁ、これでやってたら、きりがなくなってきたので、VSCODEを入れたのですが(笑)
IDEっぽくやってみます
最初に、当該ディレクトリのa.outは消しておきましょう(笑) できてるって錯覚しちゃうので(笑)
Build Taskを設定します 下を見て。。テンプレができます。
Build Taskを選ぶ
設定されてないよと言われるので、作るを選ぶ
Othersの外部コマンドを動かすを選ぶ
テンプレートができる
task.json を以下のように書き換えて、make コマンドを動かすようにします。
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "make",
"isShellCommand": true,
"showOutput": "always",
"echoCommand": true ,
"tasks": [
{ "taskName" : "MyBuild" ,"suppressTaskName": true , "args": [] ,"isBuildCommand": true}
]
}
コメントを残していただけるとありがたいです