adding all php files
This commit is contained in:
298
php/installation_test.php
Executable file
298
php/installation_test.php
Executable file
@@ -0,0 +1,298 @@
|
||||
<?php include 'global_colors.php'; ?>
|
||||
<style>
|
||||
.cpp-selected {
|
||||
background-color: var(--sidebar-highlight-color);
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.cpp-selected .icon-title {
|
||||
background-color: var(--sidebar-highlight-color);
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php include 'template_before.php'; ?>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td class="left-sidebox">
|
||||
<h1>Test your C++ Installation</h1>
|
||||
</td>
|
||||
<td class="right-sidebox">
|
||||
<div id="side-nav-buttons" class="my_sidebox">
|
||||
<ul class="sidebox">
|
||||
<li><a href="development_environment.php" class="nav-row">C++ Installation Choices for Your Operating System</a></li>
|
||||
<li><a href="wsl.php" class="nav-row">Using Windows Subsystem for Linux (WSL)</a></li>
|
||||
<li><a href="editors_ides.php" class="nav-row" id=nav-sidebar>Editors, Compilers, and IDEs</a></li>
|
||||
<li><a href="memory_debugging.php" class="nav-row">Memory Debugging</a></li>
|
||||
<li><a href="installation_test.php" class="nav-row cpp-selected sidebox">Test Your Installation</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</table>
|
||||
|
||||
|
||||
<h2>Simple Test of Compilation</h2>
|
||||
|
||||
|
||||
<ol class=DS_OL>
|
||||
|
||||
<li class=DS_LI>
|
||||
<p class=DS_P>
|
||||
To check that you're good to go, download this simple program and save
|
||||
it into your data structures course directory:
|
||||
</p>
|
||||
|
||||
<a href="lectures/temperature.cpp">temperature.cpp</a>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<li class=DS_LI>
|
||||
<p class=DS_P>
|
||||
Open a terminal and <em>change directory</em> to navigate to your data structures directory:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
cd INSERT_DATA_STRUCTURES_DIRECTORY_NAME
|
||||
</pre>
|
||||
<br>
|
||||
|
||||
</li>
|
||||
<p class=DS_P>
|
||||
Confirm you're in the right location by <em>listing</em> the directory contents typing:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
ls
|
||||
</pre>
|
||||
<br>
|
||||
|
||||
<p class=DS_P>
|
||||
You should see the file <tt>temperature.cpp</tt> and maybe some other stuff.
|
||||
</p>
|
||||
|
||||
|
||||
<li class=DS_LI>
|
||||
<p class=DS_P>
|
||||
Compile the temperature program by typing:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
g++ -Wall -g temperature.cpp -o temperature.out
|
||||
</pre>
|
||||
<br>
|
||||
|
||||
<p class=DS_P>
|
||||
(Alternatively, use <tt>clang++</tt> instead of <tt>g++</tt>.) This
|
||||
should creates an executable named temperature.out. Type <tt>ls</tt>
|
||||
again to confirm the executable appeared!
|
||||
</p>
|
||||
|
||||
<li class=DS_LI>
|
||||
<p class=DS_P>
|
||||
Now run that executable:
|
||||
</p>
|
||||
<pre>
|
||||
./temperature.out
|
||||
</pre>
|
||||
<br>
|
||||
|
||||
<p class=DS_P>
|
||||
And you should be able to interact with this program at the keyboard.
|
||||
</p>
|
||||
</ol>
|
||||
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
<h2>Simple Test of Terminating an Infinite Loop</h2>
|
||||
|
||||
|
||||
<ol class=DS_OL>
|
||||
|
||||
<li class=DS_LI>
|
||||
<p class=DS_P>
|
||||
Download and save this file to your data structures directory:
|
||||
</p>
|
||||
|
||||
<a href="lectures/infinite_loop.cpp">infinite_loop.cpp</a>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<li class=DS_LI>
|
||||
<p class=DS_P>
|
||||
Compile and run this program. It should start printing dots and not
|
||||
stop.
|
||||
</p>
|
||||
|
||||
<li class=DS_LI>
|
||||
<p class=DS_P>
|
||||
Now let's confirm that your computer is spending alot of CPU resources
|
||||
on this infinite loop. We'll view the list of all programs running on
|
||||
your computer sorted by CPU usage.
|
||||
</p>
|
||||
|
||||
<ul class=DS_UL>
|
||||
|
||||
<li class=DS_LI>
|
||||
<p class=DS_P>
|
||||
On Mac or Linux or WSL, in another terminal type:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
top -o %CPU
|
||||
</pre>
|
||||
<br>
|
||||
|
||||
<p class=DS_P>You should see the program name at or near the top of the list.
|
||||
And it should be using a large amount of CPU (depending on the number
|
||||
of processors on your machine).
|
||||
|
||||
<li class=DS_LI>
|
||||
<p class=DS_P>
|
||||
On Windows:
|
||||
</p>
|
||||
|
||||
|
||||
<ol class=DS_OL>
|
||||
<li class=DS_LI>Search for and launch "Task Manager"
|
||||
|
||||
<li class=DS_LI>Click "More Details"
|
||||
|
||||
<li class=DS_LI>Click on the "CPU" column
|
||||
</ol>
|
||||
|
||||
<p class=DS_P>You should see the program name at or near the top of the list.
|
||||
And it should be using a large amount of CPU (depending on the number
|
||||
of processors on your machine).
|
||||
</ul>
|
||||
|
||||
|
||||
<li class=DS_LI>
|
||||
<p class=DS_P>
|
||||
Confirm that you can terminate the runaway program by pressing Ctrl-c.
|
||||
</p>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
<h2>Simple Test of Memory Debugger Installation & Usage</h2>
|
||||
|
||||
<ol class=DS_OL>
|
||||
<li class=DS_LI>
|
||||
<p class=DS_P>
|
||||
Download and save this short (intentionally buggy) program:
|
||||
</p>
|
||||
|
||||
<a href="lectures/memory_bugs.cpp">memory_bugs.cpp</a>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<li class=DS_LI>
|
||||
<p class=DS_P>
|
||||
Follow the instructions for your system to compile and run this program for
|
||||
<a href="memory_debugging.php">Memory Debugging</a>.
|
||||
</p>
|
||||
|
||||
<li class=DS_LI>
|
||||
<p class=DS_P>
|
||||
Now run the program under the memory debugger and locate the report
|
||||
generated by the memory debugger. (It may be printed directly to the
|
||||
terminal and/or saved to a file.)
|
||||
</p>
|
||||
|
||||
</ol>
|
||||
|
||||
<p class=DS_P>
|
||||
<em>NOTE: The memory debugger report contains lots of data which can
|
||||
be intimidating the first time you see it. This tiny program has 4
|
||||
different errors! We'll discuss the code, and the errors, and how to
|
||||
understand this report a few weeks into the term.</em>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
<h2>Simple Test of the Traditional Debugger</h2>
|
||||
|
||||
<ol class=DS_OL>
|
||||
|
||||
<li class=DS_LI><p class=DS_P> Launch the temperature program (or another executable) inside of the <tt>gdb</tt> debugger:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
gdb ./temperature.out
|
||||
</pre>
|
||||
<br>
|
||||
|
||||
<li class=DS_LI><p class=DS_P>At the gdb prompt, start the program:</p>
|
||||
|
||||
<pre>
|
||||
run
|
||||
</pre>
|
||||
<br>
|
||||
|
||||
<li class=DS_LI><p class=DS_P>If the program is still running, press Ctrl-C. To see the
|
||||
stack backtrace of the program (listing the functions you are in the
|
||||
middle of), type:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
bt
|
||||
</pre>
|
||||
<br>
|
||||
|
||||
<li class=DS_LI><p class=DS_P>
|
||||
Finally, close gdb:
|
||||
|
||||
<pre>
|
||||
quit
|
||||
</pre>
|
||||
<br>
|
||||
|
||||
<p class=DS_P>
|
||||
(You will have to press 'y' if the program is still running.)
|
||||
</p>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
<p class=DS_P>
|
||||
If you're using LLVM's <tt>clang++</tt> instead of <tt>g++</tt>, you'll also use LLVM's
|
||||
<tt>lldb</tt> instead of <tt>gdb</tt>. The above commands are the
|
||||
same (just substitute <tt>lldb</tt> for <tt>gdb</tt>), and many of the
|
||||
other commands are similar:
|
||||
</p>
|
||||
|
||||
<p class=DS_P>
|
||||
|
||||
<a href="https://lldb.llvm.org/lldb-gdb.html">A handy table of the different gdb/lldb commands</a>
|
||||
</p>
|
||||
</br>
|
||||
|
||||
<p class=DS_P>
|
||||
<em>NOTE: The traditional debugger has many powerful features that you
|
||||
should learn over the term. Follow online tutorials and ask for help
|
||||
in lab and office hours to most effectively debug your programming
|
||||
assignments.</em>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
<?php include 'template_after.php'; ?>
|
||||
Reference in New Issue
Block a user