Ted's Blog

Happy coding

gdb的最简单用法

Ted posted @ 2008年8月28日 22:13 in 未分类 with tags gdb , 5372 阅读

1.在编译时加入参数 ”-g” 使编译出来的程序带debug信息

$>gcc test.c –g –o test

2. gdb运行程序

a)         运行gdb

$>gdb test

b)        运行程序,带参数

(gdb) run arg1 arg2 arg3

3.连接到一个正在执行的程序

a)         看该程序的进程号

$>ps –aux

b)        运行gdb

$>gdb

c)        连接gdb与该进程

(gdb) attach 进程号

d)        此时程序处于中断状态,让程序往下执行

(gdb) continue

4.设置断点

a)         设置断点

(gdb) break 函数名

(gdb) break 46 if testsize==100  如果变量testsize等于100,则在46行停

b)        执行到断点后程序就停下来了,此时让程序执行下一行

                         i.              执行下一行,如遇函数跳过

(gdb) next

                       ii.              执行下一行,如遇函数进入

(gdb) step

                      iii.              如果在step时进入了函数,执行到一半想跳过函数

              (gdb) finish

c)        让程序继续往下执行 

(gdb) continue

d)        删除断点

                         i.              删除某一断点

(gdb) delete breakpoint 断点号

                       ii.              删除所有断点

(gdb) clear

5.看变量状态

a)         显示变量值

(gdb) print 变量名

b)        显示变量类型

(gdb) whatis 变量名

6.看程序中的当前位置(在程序死了的时候看容易看到是怎么死的)

(gdb) backtrace (gdb) where

7.看相应程序代码

按键Ctrl+x, 再铵a, 则可以看到当前执行的程序所对应的代码,再按一遍切回去

Avatar_small
kevin 说:
2020年9月10日 21:58

A lot of my colleagues actually suggested me to use the services of signnow.com/ask/what-does-eidas-mean-for-your-business. I will definitely share my reviews about it soon on my blog and make sure that you guys check it out for sure.

Avatar_small
import aliexpress pr 说:
2020年10月30日 01:58

This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value. Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future... import aliexpress products to

Avatar_small
UMAIR 说:
2021年2月23日 20:21

Thanks so much with this fantastic new web site. I’m very fired up to show it to anyone. It makes me so satisfied your vast understanding and wisdom have a new channel for trying into the world. https://caldwells.com/interior-doors/caldwells-signature-door-series

Avatar_small
Faddy 说:
2021年7月24日 16:44

I read that Post and got it fine and informative. merchant services jobs near me

Avatar_small
asdasd 说:
2021年9月02日 15:56

I am extremely delighted in for this web journal. Its a useful subject. It help me all that much to take care of a few issues. Its chance are so awesome and working style so rapid. N95 mask

Avatar_small
asdzxc 说:
2021年9月05日 01:25

Tunasbola adalah situs resmi Login SBOBET, judi SBOBET Bola & Casino, agen SBOBET88 dengan minimal deposit 50ribu dan bonus terbesar di indonesia sbobet

Avatar_small
no excuses runner 说:
2021年9月05日 14:52

Enjoy effective Pest Control Services in all London areas by Archers Pest Control. Our pest treatments are guaranteed! Contact us today or book online your emergency pest exterminator. bed bug treatment London

Avatar_small
no excuses runner 说:
2021年9月05日 16:15

We recommend the Toto site, which has been operated safely for at least 4 years without incidents such as eating out, through a rigorous verification process. 먹튀검증

Avatar_small
no excuses runner 说:
2021年9月08日 16:22

Reptiles Exotiques. All, All Animals, Exclusive Exotics, Geckos, LIzards, Mammals, Snakes, Tegus, Tortoises, Turtles, Venomous. Search for: 2018 VPI Axanthic Enchi Ball Python

Avatar_small
no excuses runner 说:
2021年9月11日 19:10

DEWELPRO LLC was born out of our love and care towards the furry babies. Our innovative flea collars are to improve their quality of life with just a simple vision: https://dewelpro.com

Avatar_small
aспално бельо 说:
2021年9月15日 18:14

This blog is so nice to me. I will keep on coming here again and again. Visit my link as well.. katcr.to

Avatar_small
aспално бельо 说:
2021年9月15日 19:46

I read your blog frequently and I just thought I’d say keep up the amazing work! The Pirate Bay

Avatar_small
aспално бельо 说:
2021年9月15日 20:28

I am incapable of reading articles online very often, but I’m happy I did today. It is very well written, and your points are well-expressed. I request you warmly, please, don’t ever stop writing. 1337x.to

Avatar_small
aспално бельо 说:
2021年9月15日 21:01

Thanks for the blog filled with so many information. Stopping by your blog helped me to get what I was looking for. Now my task has become as easy as ABC. F95 game

Avatar_small
aспално бельо 说:
2021年9月19日 14:58

enamel badges made to order, Badge Creation make all types of badges and lapel pins, enamel and printed. Call us on 0845 299 6550 https://www.badgecreation.co.uk

Avatar_small
aспално бельо 说:
2021年9月22日 16:45

Thanks for picking out the time to discuss this, I feel great about it and love studying more on this topic. It is extremely helpful for me. Thanks for such a valuable help again. แทงบอลufabetเว็บไหนดี

Avatar_small
sadiq 说:
2021年10月18日 13:33

Nice blog and absolutely outstanding. You can do something much better but i still say this perfect.Keep trying for the best. unexpected store exception

Avatar_small
sadiq 说:
2021年10月18日 16:09

I’ve read some good stuff here. Definitely worth bookmarking for revisiting. I surprise how much effort you put to create such a great informative website. System Service Exception

Avatar_small
sadiq 说:
2021年10月18日 16:26

Very good written article. It will be supportive to anyone who utilizes it, including me. Keep doing what you are doing – can’r wait to read more posts. How to move steam games to another drive

Avatar_small
sadiq 说:
2021年10月18日 16:42

Simply this site is likely to it goes without saying quite possibly possibly be renowned affecting quite a few information sites person's, to its aware content pieces or it could be viewpoints. Steam Client Bootstrapper

Avatar_small
sadiq 说:
2021年10月21日 15:16

I went over this internet site and I believe you have a lot of superb information, saved to fav (:. Participant observation

Avatar_small
sadiq 说:
2021年10月24日 18:26

Your blog has chock-a-block of useful information. I liked your blog's content as well as its look. In my opinion, this is a perfect blog in all aspects. What to watch on Netflix

Avatar_small
yousuf 说:
2021年12月01日 16:46

This is really interesting, You are an excessively skilled blogger. I have joined your rss feed and look ahead to in the hunt for extra of your great post. Also, I’ve shared your website in my social networks! total sports apparel

Avatar_small
yousuf 说:
2021年12月09日 19:54

Hey, you used to write magnificent, but the last several posts have been kinda boring… I miss your tremendous writings. Past several posts are just a little out of track! come on! medicinal marijuana dispensaries in california

Avatar_small
COOK 说:
2022年1月24日 19:09

I definitely enjoying every little bit of it. It is a great website and nice share. I want to thank you. Good job! You guys do a great blog, and have some great contents. Keep up the good work. 토토커뮤니티

Avatar_small
. 카지노사이트 说:
2022年2月14日 03:38

I really impressed after read this because of some quality work and informative thoughts . I just wanna say thanks for the writer and wish you all the best for coming!. after divorce vacation

Avatar_small
. 카지노사이트 说:
2022年2月20日 03:09

You completed a few fine points there. I did a search on the subject and found nearly all persons will go along with with your blog. types of combat knives

Avatar_small
virus 说:
2022年2月20日 18:49

This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post. write my essay for me

Avatar_small
. 카지노사이트 说:
2022年2月22日 00:47

Nice post mate, keep up the great work, just shared this with my friendz reinigungsfirma

Avatar_small
. 카지노사이트 说:
2022年2月22日 02:57

It was wondering if I could use this write-up on my other website, I will link it back to your website though.Great Thanks. Motorcycle LED Lights Brightest LED Lights for Motorcycles

Avatar_small
. 카지노사이트 说:
2022年2月25日 03:26

I visit your blog regularly and recommend it to all of those who wanted to enhance their knowledge with ease. The style of writing is excellent and also the content is top-notch. Thanks for that shrewdness you provide the readers! Telephonic Interpreters

Avatar_small
. 카지노사이트 说:
2022年3月08日 03:34

What a fantabulous post this has been. Never seen this kind of useful post. I am grateful to you and expect more number of posts like these. Thank you very much. cheap valorant boost

Avatar_small
virus 说:
2022年3月15日 15:07

I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much. stiri transilvania

Avatar_small
. 카지노사이트 说:
2022年3月19日 03:41

Great post, and great website. Thanks for the information! Covid testing at home

Avatar_small
. 카지노사이트 说:
2022年3月22日 01:40 I went over this website and I believe you have a lot of wonderful information, saved to my bookmarks ดูหนัง
Avatar_small
. 카지노사이트 说:
2022年3月22日 01:56

Some truly wonderful work on behalf of the owner of this internet site , perfectly great articles . ดูหนัง hd

Avatar_small
yousuf 说:
2022年4月10日 17:42

There are various posts on the market near this, I think taking there reference could experience chose to make this spot or article really informative. Practical goal expression this post is unhealthy. Simply I have to pronounce that this info provided here was unique, merely to make it more near complete, supporting compared to other former information will get been actually good. The points you get touched here’s important, thus I most certainly will spot some of the information here to build this actually beneficial to entirely the newbie’s here. Appreciate your these records. Actually helpful! โปรสล็อต

Avatar_small
yousuf 说:
2022年4月10日 19:44

I am constantly browsing online with regard to articles that may benefit me. Thanks! amb poker

Avatar_small
yousuf 说:
2022年4月12日 17:49

seafoods are great because they are really tasty, i think that almost all seafoods are super duper tasty,, https://www.yabobets88.com/

Avatar_small
yousuf 说:
2022年4月13日 18:00

You must take part in a contest for probably the greatest blogs on the web. I’ll suggest this website! jilislot444.com

Avatar_small
yousuf 说:
2022年4月13日 19:37

Amazing post – Gulvafslibning | Kurt Gulvmand however hey I having a issue we can not seem to be capable of sign up your rss feed, I am using bing reader fyi Thx ! Flash Factory jili slot เล่นผ่านเว็บ

Avatar_small
yousuf 说:
2022年4月14日 18:48

I wrote something to introduce this challenge for my readers” สล็อต

Avatar_small
yousuf 说:
2022年4月16日 14:51

You could certainly see your enthusiasm in the work you write. The world hopes for even more passionate writers like you who aren’t afraid to say how they believe. Always follow your heart. gmail posta in arrivo accedi

Avatar_small
yousuf 说:
2022年4月16日 18:31

fapturbo review Nice post. I understand something more challenging on diverse blogs everyday. Most commonly it is stimulating to read content from other writers and rehearse something from their site. I’d want to apply certain while using the content in my weblog no matter whether you don’t mind. Natually I’ll provide link on the internet blog. Many thanks for sharing. https://www.5g999.co/baccarat

Avatar_small
yousuf 说:
2022年4月17日 17:44

i was earning lots of money from dropshipping and it was a nice business for starters,, akaslot

Avatar_small
yousuf 说:
2022年4月17日 19:31

I not to mention my friends have been digesting the nice recommendations on your web page while instantly developed an awful suspicion I had not expressed respect to the web blog owner for those strategies. My people were so happy to see them and have now in reality been having fun with those things. Many thanks for actually being simply thoughtful and then for making a choice on varieties of cool areas most people are really wanting to be informed on. Our sincere regret for not saying thanks to earlier. สล็อต

Avatar_small
yousuf 说:
2022年4月18日 18:13

Oh my goodness! an amazing article dude. Thank you However I’m experiencing challenge with ur rss . Don’t know why Unable to subscribe to it. Is there anyone getting identical rss downside? Anyone who is aware of kindly respond. Thnkx สล็อต

Avatar_small
yousuf 说:
2022年4月19日 18:55

What would most of us do minus the marvellous strategies you share on this blog? Who else has got the endurance to deal with crucial topics with regard to common readers like me? I and my buddies are very delighted to have your web site among the ones we typically visit. We hope you know how a great deal we value your efforts! Best wishes from us all. winslotxo.com

Avatar_small
yousuf 说:
2022年4月20日 14:45

Thank you for the sensible critique. Me & my neighbor were just preparing to do some research on this. We grabbed a book from our local library but I think I learned better from this post. I am very glad to see such fantastic info being shared freely out there. winslot

Avatar_small
yousuf 说:
2022年4月21日 15:57

You could certainly see your enthusiasm in the work you write. The world hopes for even more passionate writers like you who aren’t afraid to say how they believe. Always follow your heart. https://www.5g999.co/slot

Avatar_small
. 카지노사이트 说:
2022年5月10日 02:44

This is a great article thanks for sharing this informative information. I will visit your blog regularly for some latest post. I will visit your blog regularly for Some latest post. Used Cars in Nashville Cars for Sale in Nashville

Avatar_small
yousuf 说:
2022年5月11日 22:44

Aw, i thought this was a really nice post. In concept I must place in writing such as this additionally – taking time and actual effort to make a great article… but what things can I say… I procrastinate alot and also by no indicates seem to go carried out. link judi bola terpercaya

Avatar_small
JazzyExpert 说:
2022年5月24日 12:48

It’s nearly impossible to find knowledgeable men and women about this topic, however, you appear to be you know what you’re referring to! Thanks dawang foundry

Avatar_small
yousuf 说:
2022年5月29日 16:15 i love funny stuffs, but i specially like funny movies and funny videos on the internet.. Escort Service In Delhi
Avatar_small
yousuf 说:
2022年5月29日 22:34 This is a correct weblog for everyone who is hopes to be familiar with this topic. You realize much its practically challenging to argue together with you (not too When i would want…HaHa). You actually put a whole new spin for a topic thats been discussed for decades. Great stuff, just great! quit smoking
Avatar_small
JazzyExpert 说:
2022年7月03日 23:23

That is furthermore a good submit that i actually appreciated studying. It isn't each day that we hold the chance to find out one thing. sbobet88

Avatar_small
JazzyExpert 说:
2022年7月05日 16:17

I am frequently to blogging we genuinely appreciate your content regularly. Your content has really peaks my interest. I am about to bookmark your internet site and keep checking choosing data. slot demo habanero

Avatar_small
JazzyExpert 说:
2022年7月07日 14:35

You really should be a part of a tournament for just one of the best blogs on the internet. I will recommend this page! sbobet88 indonesia

Avatar_small
dark web/deep web/d 说:
2022年8月04日 18:49

There is no header to indicate which domain or page is linked to. Each link is invisible until you click on it, making it impossible to track or scan for viruses or harmful software.   dark web links

Avatar_small
dark web/deep web/d 说:
2022年8月04日 19:33

There are many different reasons why these hackers choose to target websites that have a JavaScript code. One of the primary reasons is because these sites often contain many graphics that many users do not want to open.   deep web

Avatar_small
dark web/deep web/d 说:
2022年8月04日 19:49

Hackers can easily create new sites to steal your identity, and you could unknowingly become a victim of scams and other criminal activity. dark web links

Avatar_small
dark web/deep web/d 说:
2022年8月04日 20:11

I am sure that some of you are saying; well I know plenty of individuals who frequent the dark web, they are just normal users. Others argue that such links lead only to criminals, drug dealers, hackers, and identity thieves, well that's just not true. I know plenty of people who visit the dark web, and also live in cyberspace as well.   dark web sites

Avatar_small
dark web/deep web/d 说:
2022年8月04日 20:27

This way, you can get around the dangerous individuals and dangers that may pop up while you are looking at links. I use both the Mac interface and Windows interface to surf the net, and the privacy that you get with the VPN service is worth the price you pay.  dark web

Avatar_small
dark web/deep web/d 说:
2022年8月04日 20:42

The next thing that Chia teaches you in his course, and that you will find helpful in your own affiliate marketing business, is how to choose the right affiliate programs.   work from home jobs

Avatar_small
dark web/deep web/d 说:
2022年8月04日 20:58

While some are benefiting from a few select techniques, others are benefiting from a comprehensive overhaul. If you've been around for awhile, there's no doubt you've heard the same stories.   affiliate marketing success


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter