Module4 New Technology 全模块能力测试卷

Module4 New Technology 全模块能力测试卷
2011年05月26日
  Module4 New Technology 全模块能力测试卷
  一、选择题
  1、If his mother _______, no one will look after him.
  A will die B dies C died D dying
  2、Her knife is on the floor. Could you ______for her?
  A pick it up B pick up it C pick them up Dpick up them
  3、The moon light is coming in _____the window and the room seems quiet and beautiful
  A over B through C cross D across
  4、.If you are afraid of doing it, just _______me A telling B to tell C told D tell
  5、Don’t eat too much sweet . It’s bad ________ your health.
  A good B with C at D for
  6、It’s important _________ the piano well
  A of him to play B for him to play C of him playing D for him playing
  7、 Be quick ,_______ you will miss the train A and B if C unless D or
  8、Xiao Li sits ________ me A nearby B be close C close D close to
  9.---What ________ music do you like? ---I like soft music
  A kind B kind of C kinds of D kinds
  10、We will ________ a lot of time if we go by car.
  A store B save C prepare D press
  11、The snake bit Jim _______his leg A in B at C with D on
  12、________ you don’t know what to do , ask your teacher for help.
  A Weather B If C However D until
  13、If you ________ to send an email ,_______ your computer
  A wants use B want use C want to use D would like using
  14、.If you ______ him tomorrow ,please ask him if he______ to Beijing with us .
  A see goes B see will go C will see goes D will see will go
  15、It don’t think _______ important to tell hin about it right now.
  A this B that C it D him
  16、I’m not sure _______ it’s a good idea A that B what C how D if
  17、If you want to ______recorder. Please press the stop button
  A turn on B turn off C turn up D turn down
  18、.He is quite kind that he _____ his violin to me.
  A lend B keep C borrow D make
  19、.How long can I _______ the CD player? A borrow B lend C keep D buy
  20、.I ______ a book from him last week. And I _______ for five days
  A lent had borrow B borrowed keep C kept lend D borrowed have kept
  21、._______ ,boys and girls. You can do it!
  A Come on B Why C Of course D Come
  22、If the red light doesn’t _______ ,wait for a moment.
  A come out B come on C come to D come in
  23、She suggested _____ early so that we could catch the first train.
  A. to get up B. getting up C. get up D. to getting up
  24. If there are a lot of buses on the road, you'd better _______as slowly as you can.
  A. drive B. drives C. driving D. to drive
  25、I don't know if it ______ tomorrow. If it ______, I will stay at home.
  A. will rain, rains B. rains, will rain C. will rain, will rain D. rains , rains
  26、.Stop talking. I have _____ to tell you.A. anything interesting B. interesting something
  C. something interesting D interesting anything
  27、Our teachers often advise us _________ computer games a lot.
  A. to play B. playing C. not to play D. not playing
  28、Please take out your notebook and_________.
  A. write it down B. write down them C. write down it D. wrote it down
  二.完型填空
  Big schoolbags have been a serious problem for students for a long time. Maybe your schoolbag is too 1 to carry, and it troubles you a lot 2 you want to find a book out to read. Now an e-textbook will 3 you.
  It is said that e-textbooks are going to be 4 in Chinese middle schools. An e-textbbok, in fact, is a small 5 for students. It is much 6 than a usual schoolbag and easy to carry. Though it is as small as a book, it can 7 all the materials(材料) for study. The students can read the text page by page on the 8 , take notes with the pointer(屏写笔) . or even " 9" their homework to their teachers by sending e-mails. All they have to do is to press a button.
  Some people says e-textbooks are good , but some say they maybe 10 for the students' eyes. What do you think of it?
  ( )1. a. light b. heavy c. useful d. comfortable
  ( )2. a. till b. after c. before d. when
  ( )3. a. trouble b. prepare c. help d. understand
  ( )4. a. used b. kept c. invented d. lent
  ( )5. a. TV b. radio c. pen d. computer ( )6. a. heavier b. lighter c. cheaper d. brighter ( )7. a. hold b. build c. discover d. practise ( )8. a. blackboard b. desk c. screen d. card ( )9. a. find out b. hand in c. get back d. gove back ( )10. a. helpful b. famous c. good d. bad 三、单词拼写(10分)
  1.Type in the website, ______( 按)the “enter” button, you’ll see it.
  2.That will make a great collection, and we can all have a ________(备份) .
  3.He took _____(录像)of many things that people had never seen before.
  4. The computer has a large _____(内存).
  5.Suddenly, many icebergs _______( 出现) in front of the ship. Everyone was surprised.
  6. Before taking the medicine, you’d better read the ________(说明).
  7. He _____(建议) me going home earlier.
  8. The little boy is very naughty. He often ______( 躲藏) himself somewhere.
  9. The boy was ill and he had to take the ______(药)
  10.Ladies and_______(先生们), let’s welcome our headmaster.
  四.、时态填空(15分)
  1.They decided _____ (visit) Radio Beijing with Sally.
  2. Keep _____ (study) English if you want to work on Radio Beijing.
  3. People from all over the world make friends by _______ (write) letters.
  4. If it ____ (be) sunny tomorrow, I _____ (walk) to school.
  5. We ____ (not have) our sports meeting if the weather ____ (not be ) fine.
  6. If it ___ (rain), my father _____ (take) me to school in his car.
  7. If you _____ (not know) the answer, please _____ (ask) Mary.
  8. He ___ (lend) his CD to me last week.
  9. Try _____ (spend) some time alone with your friend.
  10.Don’t talk! The students _____ (have) a test.
  11. Suddenly a dog _____ ( appear) and ____ (bite) him on the leg.
  12. ____ (read) English books is good for us.
  13. Mary ______ (live) here since she _____ (move)here three years ago.
  14. I don’t know which sweater ______ (buy).
  15. Yesterday he ____ (fall) off the bike and _____ (hurt) his leg.
  五、条件状语从句
  1、Do you know if we _______________(pass) the exam?
  If we _________(pass) it, tell me quickly.
  2、Do you know if they __________(come) tonight?
  If they __________(come)here, call me.
  3、I am not sure if father __________(buy) a computer for me.
  If he _________(buy) one, I will be very happy.
  4、He wants to know if the library ____________(open) this afternoon.
  If it _________(open), he will go to return the books.
  5、---I want to know if you ________ (come)to the meeting this afternoon.
  ---I will come if I ________(be) free.
  6、. I wonder if my parents _________(send) me a present for my birthday.
  If they ________(send) me a cell phone , I will be really very happy.
  7、.I wonder if it ________(rain) tomorrow. If it _________(rain),we won’t go shopping.、
  六词语运用(10分)Come on, play back, turn on, save one’s life, connect….to,
  text message, pick up, kind of , find out, do with
  1. If you ______ how to use the camera, read the instructions.
  2. What do you do if you want to send ____________.
  3. Do you know how to ______ the printer _____ the computer?
  4. If you like great music, ______ the radio.
  5. we recorded the match yesterday. Let’s _________ the video now.
  6. I don’t know what ________ film it is. Maybe it’s a detective one.
  7. Could you tell me whether the green light _________? Yes, it does.
  8. What do you_________ your old books?
  -- I send them to the poor children in hope school.
  9. Please ________ all your toys when you’ve finished playing.
  10. The photo _________ because now I know I mustn’t touch that beautiful plant.
  七、完成下列的句子
  1. 如果要使用录音机,要看看说明
  ________ you want to ______ the recorder ,look at the _________
  2. 怎么样连接电视机和刻录机? How to _________ television _______recorder?
  3. 如果它不运转,等一分钟,然后再试一下
  If it ______ _______(work) ,______ ______ one minute ,then ______ again .
  4、这是一个英国厨师的令人惊奇的建议。 This is the ___________ ___________ of a British cook. 5、突然、一条蛇出现了,并且咬了他的手。
  Suddenly, a snake __________, and _____ him ____ _______ ______
  八[b]、短文填空(共10[/b][b]小题;每小题1[/b][b]分,满分10[/b][b]分)
  [/b]根据短文内容及所给首字母提示写出所缺单词, 并将答案写在答题卷对应题号后面。
  Earth Hour started in Sydney on March 31, 2007. M than two million homes and Businesses turned off their lights for an hour. A year 1 , in 2008, Earth Hour became the world's activity and was supported (支持)by millions of people from thirty-five countries. In 2009, over two thousand cities in the world t part in it, and Earth Hour came to China. The purpose(目的)of the activity is to save energy and i climate(气候). Earth Hour has brought about some new c to our lives.
  We may have different ways to spend the hour. For example, we can go to school on foot or b bike, plant more trees, use water more than once, never l the lights on, when we are not at home. Try to make full use of paper by using b sides. Earth Hour is a call(号召)for us to work together for a bright f . It is also a message of hope and action. Everyone can make a difference. The improvement of our environment n everyone's efforts. Come on! Join us in Earth Hour 2010!
Table of Contents Summary of gdb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Free Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Free Software Needs Free Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Contributors to gdb. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1 A Sample gdb Session . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2 Getting In and Out of gdb . . . . . . . . . . . . . . . . . . . 11 2.1 Invoking gdb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.1 Choosing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.2 Choosing Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.3 What gdb Does During Startup . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Quitting gdb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 Shell Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4 Logging Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 11 12 13 15 16 16 17 gdb Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.1 Command Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.2 Command Completion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.3 Getting Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4 Running Programs Under gdb . . . . . . . . . . . . . . . 25 4.1 Compiling for Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Starting your Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 Your Program’s Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4 Your Program’s Environment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5 Your Program’s Working Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6 Your Program’s Input and Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7 Debugging an Already-running Process . . . . . . . . . . . . . . . . . . . . . . . . 4.8 Killing the Child Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.9 Debugging Multiple Inferiors and Programs. . . . . . . . . . . . . . . . . . . . 4.10 Debugging Programs with Multiple Threads . . . . . . . . . . . . . . . . . . 4.11 Debugging Forks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.12 Setting a Bookmark to Return to Later. . . . . . . . . . . . . . . . . . . . . . . 4.12.1 A Non-obvious Benefit of Using Checkpoints . . . . . . . . . . . . . 25 25 28 29 30 30 31 32 32 35 38 40 41 ii 5 Debugging with gdb Stopping and Continuing . . . . . . . . . . . . . . . . . . . . . 43 5.1 Breakpoints, Watchpoints, and Catchpoints . . . . . . . . . . . . . . . . . . . 5.1.1 Setting Breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.2 Setting Watchpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.3 Setting Catchpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.4 Deleting Breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.5 Disabling Breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.6 Break Conditions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.7 Breakpoint Command Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.8 “Cannot insert breakpoints” . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.9 “Breakpoint address adjusted...”. . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Continuing and Stepping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3 Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4 Stopping and Starting Multi-thread Programs . . . . . . . . . . . . . . . . . 5.4.1 All-Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.2 Non-Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.3 Background Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.4 Thread-Specific Breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.5 Interrupted System Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 44 49 51 55 55 56 58 59 59 60 63 65 65 67 68 69 69 6 Running programs backward . . . . . . . . . . . . . . . . . 71 7 Recording Inferior’s Execution and Replaying It . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 8 Examining the Stack . . . . . . . . . . . . . . . . . . . . . . . . . . 77 8.1 8.2 8.3 8.4 9 Stack Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Backtraces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Selecting a Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Information About a Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 78 80 81 Examining Source Files . . . . . . . . . . . . . . . . . . . . . . . 83 9.1 Printing Source Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2 Specifying a Location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3 Editing Source Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.1 Choosing your Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4 Searching Source Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.5 Specifying Source Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.6 Source and Machine Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 84 85 85 86 86 89 iii 10 Examining Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 10.1 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 10.2 Ambiguous Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 10.3 Program Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 10.4 Artificial Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 10.5 Output Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 10.6 Examining Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 10.7 Automatic Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 10.8 Print Settings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 10.9 Value History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 10.10 Convenience Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 10.11 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 10.12 Floating Point Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 10.13 Vector Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 10.14 Operating System Auxiliary Information . . . . . . . . . . . . . . . . . . . 112 10.15 Memory Region Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 10.15.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 10.15.1.1 Memory Access Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 10.15.1.2 Memory Access Size. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 10.15.1.3 Data Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 10.15.2 Memory Access Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 10.16 Copy Between Memory and a File . . . . . . . . . . . . . . . . . . . . . . . . . 115 10.17 How to Produce a Core File from Your Program . . . . . . . . . . . 116 10.18 Character Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 10.19 Caching Data of Remote Targets . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 10.20 Search Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 11 Debugging Optimized Code . . . . . . . . . . . . . . . . 123 11.1 Inline Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 12 C Preprocessor Macros . . . . . . . . . . . . . . . . . . . . . 125 13 Tracepoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 13.1 Commands to Set Tracepoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.1.1 Create and Delete Tracepoints . . . . . . . . . . . . . . . . . . . . . . . . . 13.1.2 Enable and Disable Tracepoints . . . . . . . . . . . . . . . . . . . . . . . . 13.1.3 Tracepoint Passcounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.1.4 Tracepoint Conditions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.1.5 Trace State Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.1.6 Tracepoint Action Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.1.7 Listing Tracepoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.1.8 Starting and Stopping Trace Experiments . . . . . . . . . . . . . . 13.2 Using the Collected Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.2.1 tfind n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.2.2 tdump. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.2.3 save-tracepoints filename . . . . . . . . . . . . . . . . . . . . . . . . . . 13.3 Convenience Variables for Tracepoints . . . . . . . . . . . . . . . . . . . . . . . 13.4 Using Trace Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 130 131 131 131 132 132 134 134 136 136 138 138 139 139 iv Debugging with gdb 14 Debugging Programs That Use Overlays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 14.1 14.2 14.3 14.4 15 How Overlays Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Overlay Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Automatic Overlay Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Overlay Sample Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 142 144 145 Using gdb with Different Languages . . . . . . 147 15.1 Switching Between Source Languages . . . . . . . . . . . . . . . . . . . . . . . 15.1.1 List of Filename Extensions and Languages . . . . . . . . . . . . . 15.1.2 Setting the Working Language . . . . . . . . . . . . . . . . . . . . . . . . . 15.1.3 Having gdb Infer the Source Language . . . . . . . . . . . . . . . . . 15.2 Displaying the Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.3 Type and Range Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.3.1 An Overview of Type Checking . . . . . . . . . . . . . . . . . . . . . . . . 15.3.2 An Overview of Range Checking . . . . . . . . . . . . . . . . . . . . . . . 15.4 Supported Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.1 C and C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.1.1 C and C++ Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.1.2 C and C++ Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.1.3 C++ Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.1.4 C and C++ Defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.1.5 C and C++ Type and Range Checks . . . . . . . . . . . . . . . 15.4.1.6 gdb and C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.1.7 gdb Features for C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.1.8 Decimal Floating Point format . . . . . . . . . . . . . . . . . . . . 15.4.2 Objective-C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.2.1 Method Names in Commands . . . . . . . . . . . . . . . . . . . . . 15.4.2.2 The Print Command With Objective-C . . . . . . . . . . . . 15.4.3 Fortran . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.3.1 Fortran Operators and Expressions . . . . . . . . . . . . . . . . 15.4.3.2 Fortran Defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.3.3 Special Fortran Commands . . . . . . . . . . . . . . . . . . . . . . . . 15.4.4 Pascal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.5 Modula-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.5.1 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.5.2 Built-in Functions and Procedures . . . . . . . . . . . . . . . . . 15.4.5.3 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.5.4 Modula-2 Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.5.5 Modula-2 Defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.5.6 Deviations from Standard Modula-2 . . . . . . . . . . . . . . . 15.4.5.7 Modula-2 Type and Range Checks. . . . . . . . . . . . . . . . . 15.4.5.8 The Scope Operators :: and . . . . . . . . . . . . . . . . . . . . . 15.4.5.9 gdb and Modula-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.6 Ada . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.6.2 Omissions from Ada . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.6.3 Additions to Ada . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 147 148 148 148 149 149 150 151 151 152 153 154 155 155 155 156 157 157 157 158 158 158 159 159 159 159 159 161 162 162 164 164 164 165 165 165 165 166 167 v 15.4.6.4 Stopping at the Very Beginning . . . . . . . . . . . . . . . . . . . 15.4.6.5 Extensions for Ada Tasks . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.6.6 Tasking Support when Debugging Core Files . . . . . . 15.4.6.7 Known Peculiarities of Ada Mode . . . . . . . . . . . . . . . . . 15.5 Unsupported Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 169 172 172 173 16 Examining the Symbol Table . . . . . . . . . . . . . . 175 17 Altering Execution. . . . . . . . . . . . . . . . . . . . . . . . . . 181 17.1 17.2 17.3 17.4 17.5 17.6 18 Commands to Specify Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Debugging Information in Separate Files . . . . . . . . . . . . . . . . . . . . Errors Reading Symbol Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . GDB Data Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 193 197 198 Specifying a Debugging Target . . . . . . . . . . . . 199 19.1 19.2 19.3 20 181 182 183 183 184 185 gdb Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 18.1 18.2 18.3 18.4 19 Assignment to Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Continuing at a Different Address . . . . . . . . . . . . . . . . . . . . . . . . . . . Giving your Program a Signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Returning from a Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Calling Program Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Patching Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Active Targets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 Commands for Managing Targets . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 Choosing Target Byte Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 Debugging Remote Programs . . . . . . . . . . . . . . 203 20.1 Connecting to a Remote Target . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20.2 Sending files to a remote system . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20.3 Using the gdbserver Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20.3.1 Running gdbserver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20.3.1.1 Attaching to a Running Program . . . . . . . . . . . . . . . . . . 20.3.1.2 Multi-Process Mode for gdbserver . . . . . . . . . . . . . . . . 20.3.1.3 Other Command-Line Arguments for gdbserver . . . 20.3.2 Connecting to gdbserver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20.3.3 Monitor Commands for gdbserver . . . . . . . . . . . . . . . . . . . . . 20.4 Remote Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20.5 Implementing a Remote Stub . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20.5.1 What the Stub Can Do for You . . . . . . . . . . . . . . . . . . . . . . . . 20.5.2 What You Must Do for the Stub . . . . . . . . . . . . . . . . . . . . . . . 20.5.3 Putting it All Together. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 205 205 205 206 206 207 207 207 208 212 213 214 215 vi Debugging with gdb 21 Configuration-Specific Information . . . . . . . . 217 21.1 Native . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.1.1 HP-UX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.1.2 BSD libkvm Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.1.3 SVR4 Process Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.1.4 Features for Debugging djgpp Programs . . . . . . . . . . . . . . . 21.1.5 Features for Debugging MS Windows PE Executables . . 21.1.5.1 Support for DLLs without Debugging Symbols. . . . . 21.1.5.2 DLL Name Prefixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.1.5.3 Working with Minimal Symbols . . . . . . . . . . . . . . . . . . . 21.1.6 Commands Specific to gnu Hurd Systems . . . . . . . . . . . . . . 21.1.7 QNX Neutrino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.1.8 Darwin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2 Embedded Operating Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2.1 Using gdb with VxWorks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2.1.1 Connecting to VxWorks . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2.1.2 VxWorks Download . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2.1.3 Running Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3 Embedded Processors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3.1 ARM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3.2 Renesas M32R/D and M32R/SDI . . . . . . . . . . . . . . . . . . . . . . 21.3.3 M68k . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3.4 MicroBlaze . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3.5 MIPS Embedded . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3.6 OpenRISC 1000. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3.7 PowerPC Embedded . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3.8 HP PA Embedded . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3.9 Tsqware Sparclet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3.9.1 Setting File to Debug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3.9.2 Connecting to Sparclet . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3.9.3 Sparclet Download . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3.9.4 Running and Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3.10 Fujitsu Sparclite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3.11 Zilog Z8000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3.12 Atmel AVR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3.13 CRIS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3.14 Renesas Super-H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4 Architectures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4.1 x86 Architecture-specific Issues . . . . . . . . . . . . . . . . . . . . . . . . . 21.4.2 A29K . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4.3 Alpha. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4.4 MIPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4.5 HPPA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4.6 Cell Broadband Engine SPU architecture . . . . . . . . . . . . . . . 21.4.7 PowerPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 217 217 217 219 221 222 223 223 224 226 226 227 227 228 228 229 229 229 231 232 232 232 235 236 237 237 238 238 238 238 239 239 239 239 240 240 240 241 241 241 243 243 244 vii 22 Controlling gdb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 22.1 22.2 22.3 22.4 22.5 22.6 22.7 22.8 22.9 23 Prompt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Command Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Command History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Screen Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Configuring the Current ABI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Optional Warnings and Messages. . . . . . . . . . . . . . . . . . . . . . . . . . . . Optional Messages about Internal Happenings . . . . . . . . . . . . . . . Other Miscellaneous Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 245 245 247 248 248 249 251 253 Extending gdb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 23.1 Canned Sequences of Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.1.1 User-defined Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.1.2 User-defined Command Hooks. . . . . . . . . . . . . . . . . . . . . . . . . . 23.1.3 Command Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.1.4 Commands for Controlled Output . . . . . . . . . . . . . . . . . . . . . . 23.2 Scripting gdb using Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.2.1 Python Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.2.2 Python API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.2.2.1 Basic Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.2.2.2 Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.2.2.3 Auto-loading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.2.2.4 Values From Inferior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.2.2.5 Types In Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.2.2.6 Pretty Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.2.2.7 Selecting Pretty-Printers . . . . . . . . . . . . . . . . . . . . . . . . . . 23.2.2.8 Commands In Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.2.2.9 Writing new convenience functions . . . . . . . . . . . . . . . . 23.2.2.10 Objfiles In Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.2.2.11 Acessing inferior stack frames from Python. . . . . . . 23.2.2.12 Python representation of lazy strings. . . . . . . . . . . . . 255 255 257 258 259 261 261 262 262 263 263 264 266 269 271 272 275 276 276 277 24 Command Interpreters . . . . . . . . . . . . . . . . . . . . . 279 25 gdb Text User Interface . . . . . . . . . . . . . . . . . . . . 281 25.1 25.2 25.3 25.4 25.5 26 TUI Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TUI Key Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TUI Single Key Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TUI-specific Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TUI Configuration Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 282 283 283 285 Using gdb under gnu Emacs . . . . . . . . . . . . . . . 287 viii Debugging with gdb 27 The gdb/mi Interface . . . . . . . . . . . . . . . . . . . . . . . 289 Function and Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Notation and Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.3 gdb/mi General Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.3.1 Context management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.3.2 Asynchronous command execution and non-stop mode . . 27.3.3 Thread groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.4 gdb/mi Command Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.4.1 gdb/mi Input Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.4.2 gdb/mi Output Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.5 gdb/mi Compatibility with CLI . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.6 gdb/mi Development and Front Ends . . . . . . . . . . . . . . . . . . . . . . . 27.7 gdb/mi Output Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.7.1 gdb/mi Result Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.7.2 gdb/mi Stream Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.7.3 gdb/mi Async Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.7.4 gdb/mi Frame Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.7.5 gdb/mi Thread Information . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.8 Simple Examples of gdb/mi Interaction . . . . . . . . . . . . . . . . . . . . . 27.9 gdb/mi Command Description Format . . . . . . . . . . . . . . . . . . . . . . 27.10 gdb/mi Breakpoint Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.11 gdb/mi Program Context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.12 gdb/mi Thread Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.13 gdb/mi Program Execution. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.14 gdb/mi Stack Manipulation Commands . . . . . . . . . . . . . . . . . . . . 27.15 gdb/mi Variable Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.16 gdb/mi Data Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.17 gdb/mi Tracepoint Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.18 gdb/mi Symbol Query Commands . . . . . . . . . . . . . . . . . . . . . . . . . 27.19 gdb/mi File Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.20 gdb/mi Target Manipulation Commands. . . . . . . . . . . . . . . . . . . 27.21 gdb/mi File Transfer Commands . . . . . . . . . . . . . . . . . . . . . . . . . . 27.22 Miscellaneous gdb/mi Commands . . . . . . . . . . . . . . . . . . . . . . . . . 28 gdb Annotations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 28.1 28.2 28.3 28.4 28.5 28.6 28.7 29 289 289 289 290 291 291 292 292 293 294 294 295 295 295 296 298 298 298 299 300 308 311 312 319 324 334 340 341 341 343 346 347 What is an Annotation? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The Server Prefix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Annotation for gdb Input. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Invalidation Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Running the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Displaying Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 356 356 357 357 357 358 JIT Compilation Interface . . . . . . . . . . . . . . . . . 359 29.1 29.2 29.3 JIT Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 Registering Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 Unregistering Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 ix 30 Reporting Bugs in gdb . . . . . . . . . . . . . . . . . . . . . 361 30.1 30.2 31 Have You Found a Bug? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 How to Report Bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 Command Line Editing. . . . . . . . . . . . . . . . . . . . . 365 31.1 Introduction to Line Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2 Readline Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2.1 Readline Bare Essentials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2.2 Readline Movement Commands . . . . . . . . . . . . . . . . . . . . . . . . 31.2.3 Readline Killing Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2.4 Readline Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2.5 Searching for Commands in the History . . . . . . . . . . . . . . . . 31.3 Readline Init File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.3.1 Readline Init File Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.3.2 Conditional Init Constructs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.3.3 Sample Init File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.4 Bindable Readline Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.4.1 Commands For Moving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.4.2 Commands For Manipulating The History . . . . . . . . . . . . . . 31.4.3 Commands For Changing Text . . . . . . . . . . . . . . . . . . . . . . . . . 31.4.4 Killing And Yanking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.4.5 Specifying Numeric Arguments . . . . . . . . . . . . . . . . . . . . . . . . . 31.4.6 Letting Readline Type For You. . . . . . . . . . . . . . . . . . . . . . . . . 31.4.7 Keyboard Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.4.8 Some Miscellaneous Commands . . . . . . . . . . . . . . . . . . . . . . . . 31.5 Readline vi Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 365 365 365 366 366 367 367 368 368 373 374 377 377 377 379 380 381 381 381 382 383 Using History Interactively . . . . . . . . . . . . . . . . 385 32.1 History Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.1.1 Event Designators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.1.2 Word Designators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.1.3 Modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 385 385 386 Appendix A Formatting Documentation . . . . . 389 Appendix B Installing gdb . . . . . . . . . . . . . . . . . . . . 391 B.1 B.2 B.3 B.4 B.5 B.6 Requirements for Building gdb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Invoking the gdb ‘configure’ Script . . . . . . . . . . . . . . . . . . . . . . . . Compiling gdb in Another Directory . . . . . . . . . . . . . . . . . . . . . . . . Specifying Names for Hosts and Targets . . . . . . . . . . . . . . . . . . . . . ‘configure’ Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . System-wide configuration and settings . . . . . . . . . . . . . . . . . . . . . . Appendix C 391 392 393 394 395 395 Maintenance Commands. . . . . . . . 397 x Debugging with gdb Appendix D gdb Remote Serial Protocol . . . . 403 D.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.2 Standard Replies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.3 Packets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.4 Stop Reply Packets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.5 General Query Packets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.6 Architecture-Specific Protocol Details . . . . . . . . . . . . . . . . . . . . . . . . D.6.1 ARM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.6.1.1 Breakpoint Kinds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.6.2 MIPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.6.2.1 Register Packet Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.6.2.2 Breakpoint Kinds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.7 Tracepoint Packets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.8 Host I/O Packets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.9 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.10 Notification Packets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.11 Remote Protocol Support for Non-Stop Mode . . . . . . . . . . . . . . . D.12 Packet Acknowledgment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.13 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.14 File-I/O Remote Protocol Extension . . . . . . . . . . . . . . . . . . . . . . . . D.14.1 File-I/O Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.14.2 Protocol Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.14.3 The F Request Packet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.14.4 The F Reply Packet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.14.5 The ‘Ctrl-C’ Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.14.6 Console I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.14.7 List of Supported Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . lseek . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . rename . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . unlink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . stat/fstat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . gettimeofday . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . isatty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.14.8 Protocol-specific Representation of Datatypes . . . . . . . . . . Integral Datatypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Pointer Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Memory Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . struct stat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . struct timeval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.14.9 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Open Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . mode t Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Errno Values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 404 405 413 415 428 428 428 428 428 428 429 432 433 434 434 436 436 437 437 437 438 438 439 439 439 440 441 441 441 442 442 443 443 444 444 445 445 445 445 446 446 447 447 447 447 447 xi Lseek Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.14.10 File-I/O Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.15 Library List Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.16 Memory Map Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.17 Thread List Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448 448 448 449 450 451 Appendix E The GDB Agent Expression Mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453 E.1 E.2 E.3 E.4 E.5 General Bytecode Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bytecode Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using Agent Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Varying Target Capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Rationale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453 455 459 460 460 Appendix F Trace File Format . . . . . . . . . . . . . . . 465 Appendix G Target Descriptions . . . . . . . . . . . . . 467 G.1 Retrieving Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.2 Target Description Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.2.1 Inclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.2.2 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.2.3 OS ABI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.2.4 Compatible Architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.2.5 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.2.6 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.2.7 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.3 Predefined Target Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.4 Standard Target Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.4.1 ARM Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.4.2 i386 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.4.3 MIPS Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.4.4 M68K Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.4.5 PowerPC Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467 468 468 468 469 469 469 469 470 471 471 472 472 473 473 473 Appendix H Operating System Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475 H.1 Process list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475 Appendix I GNU GENERAL PUBLIC LICENSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477 Appendix J GNU Free Documentation License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489 J.1 ADDENDUM: How to use this License for your documents . . . 495 xii Debugging
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值