|
INTERVIEW QUESTIONS
PROGRAMMING LANGUAGES
PASCAL
DETAILS
Question: How do I debug my Pascal programs?
Answer: In any cases where your program is longer than a few hundred lines, you will need to be able to run it through a debugger. Pascal programs compiled with GPC can be debugged via the GNU debugger dbg which we have installed on our Sun Fire system. However, the debugger is designed for C-code, and is rather kloncky if used with Pascal. But it is the only debugger available that works with GPC. To be able to use the debuuger with your Pascal code, you have to include the -g option in your compilation. Since this option and optimization of the code (i.e. the -O options) are mutually exclusive, you will have to remove any -O directives from your compile command lines. Then you can start the debugger by typing "gdb name_of_executable". The debugger is operated by typing in commands such as run Start the program from the beginning stop Stop the program from executing break Insert a break at a given line of the code, or in a specific subroutine or function cont Continue from the present position in the code until the next break is encountered list List the code around the present break point print Show the value of a variable
|
|
|
Category |
Pascal Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.3) By 7864 users |
Added on |
10/22/2012 6:16:12 AM |
Views |
73929 |
Rate it! |
|
|
Question:
How do I debug my Pascal programs?
Answer:
In any cases where your program is longer than a few hundred lines, you will need to be able to run it through a debugger. Pascal programs compiled with GPC can be debugged via the GNU debugger dbg which we have installed on our Sun Fire system. However, the debugger is designed for C-code, and is rather kloncky if used with Pascal. But it is the only debugger available that works with GPC. To be able to use the debuuger with your Pascal code, you have to include the -g option in your compilation. Since this option and optimization of the code (i.e. the -O options) are mutually exclusive, you will have to remove any -O directives from your compile command lines. Then you can start the debugger by typing "gdb name_of_executable". The debugger is operated by typing in commands such as run Start the program from the beginning stop Stop the program from executing break Insert a break at a given line of the code, or in a specific subroutine or function cont Continue from the present position in the code until the next break is encountered list List the code around the present break point print Show the value of a variable Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All Pascal Interview Questions & Answers - Exam Mode /
Learning Mode
|