国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁(yè) > news >正文

怎么看別人網(wǎng)站怎么做的網(wǎng)站頁(yè)面優(yōu)化內(nèi)容包括哪些

怎么看別人網(wǎng)站怎么做的,網(wǎng)站頁(yè)面優(yōu)化內(nèi)容包括哪些,免費(fèi)建博客網(wǎng)站,在線公司網(wǎng)站查詢目錄 1 GDB簡(jiǎn)介 2 GDB基本命令 3 GDB調(diào)試程序 1 GDB簡(jiǎn)介 GDB是GNU開(kāi)源組織發(fā)布的一個(gè)強(qiáng)大的Linux下的程序調(diào)試工具。 一般來(lái)說(shuō),GDB主要幫助你完成下面四個(gè)方面的功能: 1、啟動(dòng)你的程序,可以按照你的自定義的要求隨心所欲的運(yùn)行程序&#…

目錄

1 GDB簡(jiǎn)介

2 GDB基本命令

3 GDB調(diào)試程序


1 GDB簡(jiǎn)介

GDB是GNU開(kāi)源組織發(fā)布的一個(gè)強(qiáng)大的Linux下的程序調(diào)試工具。 一般來(lái)說(shuō),GDB主要幫助你完成下面四個(gè)方面的功能:

  • 1、啟動(dòng)你的程序,可以按照你的自定義的要求隨心所欲的運(yùn)行程序(按著自己的想法運(yùn)行)。
  • 2、可讓被調(diào)試的程序在你所指定的調(diào)置的斷點(diǎn)處停住。(斷點(diǎn)可以是條件表達(dá)式)
  • 3、當(dāng)程序被停住時(shí),可以檢查此時(shí)你的程序中所發(fā)生的事。
  • 4、你可以改變你的程序,將一個(gè)BUG產(chǎn)生的影響修正從而測(cè)試其他BUG。

2 GDB基本命令

Here are some of the most frequently needed GDB commands:break [file:]functionSet a breakpoint at function (in file).斷點(diǎn)run [arglist]Start your program (with arglist, if specified).bt  Backtrace: display the program stack.顯示程序堆棧print exprDisplay the value of an expression.打印c   Continue running your program (after stopping, e.g. at abreakpoint).繼續(xù)nextExecute next program line (after stopping); step over any functioncalls in the line.下一句edit [file:]function   查看當(dāng)前停止的程序行。look at the program line where it is presently stopped.list [file:]function  鍵入程序的文本當(dāng)程序停止了的位置type the text of the program in the vicinity of where it ispresently stopped.step Execute next program line (after stopping); step into any functioncalls in the line.  執(zhí)行下一行help [name]Show information about GDB command name, or general informationabout using GDB.quitExit from GDB.You can, instead, specify a process ID as a second argument or use option "-p", if you want to debug a running process:gdb program 1234gdb -p 1234

示例?

linux@linux:~/Desktop$ ls
a.out  gdb.c
linux@linux:~/Desktop$ gcc -g gdb.c
linux@linux:~/Desktop$ ./a.out 
0
1
2
3
4
hello world
linux@linux:~/Desktop$ gdb a.out
GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7
Copyright (C) 2014 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 "i686-linux-gnu".
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) l
2	
3	void print()
4	{
5		printf("hello world\n");
6	}
7	int main(int argc, const char *argv[])
8	{
9		int i;
10	
11		for (i = 0; i < 5; i++)
(gdb) b main
Breakpoint 1 at 0x804846a: file gdb.c, line 11.
(gdb) r
Starting program: /home/linux/Desktop/a.out Breakpoint 1, main (argc=1, argv=0xbffff164) at gdb.c:11
11		for (i = 0; i < 5; i++)
(gdb) c
Continuing.
0
1
2
3
4
hello world
[Inferior 1 (process 5010) exited normally]
(gdb) b 10
Note: breakpoint 1 also set at pc 0x804846a.
Breakpoint 2 at 0x804846a: file gdb.c, line 10.
(gdb) r
Starting program: /home/linux/Desktop/a.out Breakpoint 1, main (argc=1, argv=0xbffff164) at gdb.c:11
11		for (i = 0; i < 5; i++)
(gdb) c
Continuing.
0
1
2
3
4
hello world
[Inferior 1 (process 5113) exited normally]
(gdb) r
Starting program: /home/linux/Desktop/a.out Breakpoint 1, main (argc=1, argv=0xbffff164) at gdb.c:11
11		for (i = 0; i < 5; i++)
(gdb) n
12			printf("%d\n",i);
(gdb) n
0
11		for (i = 0; i < 5; i++)
(gdb) n
12			printf("%d\n",i);
(gdb) n
1
11		for (i = 0; i < 5; i++)
(gdb) p &i
$1 = (int *) 0xbffff0bc
(gdb) p i
$2 = 1
(gdb) n
12			printf("%d\n",i);
(gdb) p i
$3 = 2
(gdb) n
2
11		for (i = 0; i < 5; i++)
(gdb) n
12			printf("%d\n",i);
(gdb) n
3
11		for (i = 0; i < 5; i++)
(gdb) n
12			printf("%d\n",i);
(gdb) p i
$4 = 4
(gdb) n
4
11		for (i = 0; i < 5; i++)
(gdb) n
14		print();
(gdb) s
print () at gdb.c:5
5		printf("hello world\n");
(gdb) n
hello world
6	}
(gdb) n
main (argc=1, argv=0xbffff164) at gdb.c:15
15		return 0;
(gdb) 

3 GDB調(diào)試程序

示例:定位錯(cuò)誤

代碼

#include <stdio.h>#ifndef _CORE_void print()
{printf("hello world\n");
}
int main(int argc, const char *argv[])
{int i;for (i = 0; i < 5; i++)printf("%d\n",i);print();return 0;
}#else
int main(int argc,const char *argv[])
{int *temp = NULL;*temp = 10;   //沒(méi)有分配內(nèi)存空間,直接會(huì)出錯(cuò)return 0;
}#endif

定位錯(cuò)誤位置?

linux@linux:~/Desktop$ ls
a.out  gdb.c
linux@linux:~/Desktop$ gcc -g gdb.c -D _CORE_
linux@linux:~/Desktop$ ./a.out 
Segmentation fault (core dumped)
linux@linux:~/Desktop$ ls
a.out  core  gdb.c
linux@linux:~/Desktop$ gdb a.out core
GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7
Copyright (C) 2014 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 "i686-linux-gnu".
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.
[New LWP 5904]
Core was generated by `./a.out'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x080483fd in main (argc=1, argv=0xbfea3544) at gdb.c:24
24		*temp = 10;   //沒(méi)有分配內(nèi)存空間,直接會(huì)出錯(cuò)
(gdb) 

如何調(diào)試正在運(yùn)行的進(jìn)程?

源碼

linux@linux:~/Desktop$ cat gdb.c 
#include <stdio.h>
#include <unistd.h>int main(int argc, const char *argv[])
{while(1){int i;i++;printf("%d\n",i);sleep(1);}return 0;
}linux@linux:~/Desktop$ gcc -g gdb.c 
linux@linux:~/Desktop$ ./a.out 
-1217503231
-1217503230
-1217503229
-1217503228...

再開(kāi)一個(gè)終端

linux@linux:~$ ps aux | grep a.out
linux     6291  0.0  0.0   2028   280 pts/0    S+   11:47   0:00 ./a.out
linux     6293  0.0  0.0   4680   832 pts/3    S+   11:47   0:00 grep --color=auto a.out
linux@linux:~$ cd /home/linux/
.bakvim/              .gconf/               .sogouinput/
.cache/               .local/               Templates/
.config/              .mozilla/             tftpboot/
.dbus/                Music/                Videos/
Desktop/              Pictures/             .vim/
Documents/            .pki/                 vmware-tools-distrib/
Downloads/            Public/               
linux@linux:~$ cd /home/linux/Desktop/
linux@linux:~/Desktop$ ls
a.out  core  gdb.c
linux@linux:~/Desktop$ gdb a.out -p 4849
GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7
Copyright (C) 2014 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 "i686-linux-gnu".
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.
Attaching to program: /home/linux/Desktop/a.out, process 4849warning: unable to open /proc file '/proc/4849/status'warning: unable to open /proc file '/proc/4849/status'
ptrace: No such process.
(gdb) b main
Breakpoint 1 at 0x8048456: file gdb.c, line 9.
(gdb) n
The program is not being run.
(gdb) r
Starting program: /home/linux/Desktop/a.out Breakpoint 1, main (argc=1, argv=0xbffff0f4) at gdb.c:9
9			i++;
(gdb) n
10			printf("%d\n",i);
(gdb) n
-1208209407
11			sleep(1);
(gdb) n
12		}
(gdb) q
A debugging session is active.Inferior 1 [process 6317] will be killed.Quit anyway? (y or n) y
linux@linux:~/Desktop$ 

http://aloenet.com.cn/news/38347.html

相關(guān)文章:

  • 網(wǎng)站建站行業(yè)公司主頁(yè)建設(shè)希愛(ài)力副作用太強(qiáng)了
  • 滄州商貿(mào)行業(yè)網(wǎng)站建設(shè)自己有域名怎么建網(wǎng)站
  • 做網(wǎng)站收會(huì)員費(fèi)違法嗎網(wǎng)站外鏈平臺(tái)
  • 成都專門做公司網(wǎng)站的公司全網(wǎng)引擎搜索
  • 南通網(wǎng)站優(yōu)化深圳市社會(huì)組織總會(huì)
  • 網(wǎng)站建設(shè)做網(wǎng)站好嗎開(kāi)發(fā)一個(gè)網(wǎng)站
  • 旅游網(wǎng)站規(guī)劃方案產(chǎn)品推廣介紹怎么寫
  • 如何用微信做網(wǎng)站百度關(guān)鍵詞搜索排名帝搜軟件
  • 求一個(gè)全部用div做的網(wǎng)站裂變營(yíng)銷五種模式十六種方法
  • 深圳做網(wǎng)站最好的公司seo三人行網(wǎng)站
  • 大朗做網(wǎng)站蘇州優(yōu)化seo
  • 網(wǎng)站建設(shè)ktv惠州seo排名優(yōu)化
  • 網(wǎng)站建設(shè)6000元真實(shí)的優(yōu)化排名
  • 模板型網(wǎng)站建設(shè)網(wǎng)絡(luò)關(guān)鍵詞優(yōu)化軟件
  • 一級(jí)a做美國(guó)片免費(fèi)網(wǎng)站優(yōu)化大師win10能用嗎
  • 整站wordpress下載今日最新頭條新聞條
  • qq電腦版官方網(wǎng)站策劃方案
  • 鄭州高端網(wǎng)站模板app地推接單平臺(tái)
  • 專業(yè)的做網(wǎng)站軟件國(guó)外免費(fèi)發(fā)產(chǎn)品的b2b平臺(tái)
  • 先做它個(gè)天貓網(wǎng)站自己的網(wǎng)站怎么樣推廣優(yōu)化
  • 網(wǎng)站浮窗制作網(wǎng)站優(yōu)化推廣排名
  • 縉云縣城鄉(xiāng)建設(shè)局網(wǎng)站軟文技巧
  • 響應(yīng)式網(wǎng)站微博視頻百度圖片查找
  • 手機(jī)網(wǎng)站建設(shè)經(jīng)驗(yàn)seo發(fā)展前景怎么樣啊
  • 如果給公司網(wǎng)站做網(wǎng)絡(luò)廣告廣州網(wǎng)站優(yōu)化費(fèi)用
  • 怎么做跨境電商網(wǎng)站北京營(yíng)銷公司比較好的
  • 門戶網(wǎng)站建設(shè)及運(yùn)營(yíng)品牌傳播推廣方案
  • 個(gè)人網(wǎng)站建站系統(tǒng)百度搜索排名
  • 做旅行攻略的網(wǎng)站百度廣告聯(lián)盟一個(gè)月能賺多少
  • 網(wǎng)站備案 新聞審批號(hào)百度seo點(diǎn)擊排名優(yōu)化