Report detail with stacktrace done

This commit is contained in:
Latif Khalifa
2013-10-04 06:12:37 +02:00
parent f5206f7580
commit d20569b766
5 changed files with 180 additions and 2 deletions

View File

@@ -20,7 +20,7 @@ Layout::header();
<th>Grid (region)</th>
</tr>
<?php for ($i=0; $i<count($reports); $i++): ?>
<tr class="rowhighlight">
<tr class="rowhighlight hand" onclick="window.location.href='report_detail?id=<?php echo $reports[$i]->id ?>'">
<td><?php echo (int)$reports[$i]->id ?></td>
<td><?php echo htmlspecialchars($reports[$i]->client_channel . " " . $reports[$i]->client_version) ?></td>
<td><?php echo htmlspecialchars($reports[$i]->os) ?></td>

View File

@@ -22,6 +22,38 @@ class CrashReport
public $threads = array();
public $raw_stacktrace;
function htmlFrame($f)
{
static $urlBase = "https://github.com/singularity-viewer/SingularityViewer/blob/master";
$ret = "";
$link = "";
if ($f->function)
{
$ret .= htmlentities($f->function);
if ($f->source_file)
{
if (false === $pos = strpos($f->source_file, "indra"))
{
$ret .= " " . $f->source_file;
}
else
{
$source = substr($f->source_file, $pos + 6);
$source = str_replace("\\", "/", $source);
$ret .= " at " . $source;
$ret .= " (line {$f->source_line} + {$f->function_offset})";
$link = "$urlBase/indra/$source/#L{$f->source_line}";
}
}
}
if ($link)
{
$ret = '<a href="' . $link . '">' . $ret . '</a>';
}
return $ret;
}
function getTotal()
{
global $DB;
@@ -57,6 +89,27 @@ class CrashReport
return $ret;
}
function getReport($id)
{
global $DB;
$ret = array();
if (!$res = $DB->query(kl_str_sql("select * from reports where id=!i", $id)))
{
return null;
}
if ($row = $DB->fetchRow($res))
{
$r = new CrashReport;
$DB->loadFromDbRow($r, $res, $row);
$r->parseStackTrace($r->raw_stacktrace);
return $r;
}
return null;
}
function delete()
{
global $DB;

View File

@@ -12,7 +12,7 @@ class DBH
function log($line)
{
return;
//return;
static $f = false;
static $failed = false;

121
htdocs/report_detail.php Normal file
View File

@@ -0,0 +1,121 @@
<?php
define("SITE_ROOT", realpath(dirname(__file__)));
require_once SITE_ROOT . "/lib/init.php";
$S->requireUser();
$report = CrashReport::getReport((int)$_GET["id"]);
if (!$report)
{
Layout::header();
print "<h2>Report Details</h2><p>No such report</p>";
Layout::footer();
return;
}
Layout::header();
?>
<h2>Report Details</h2>
<table>
<tr>
<th>ID</th>
<td><?php echo (int)$report->id ?></td>
</tr>
<tr>
<th>Reported</th>
<td><?php echo date("r", (int)$report->reported) ?></td>
</tr>
<tr>
<th>Channel</th>
<td><?php echo htmlentities($report->client_channel) ?></td>
</tr>
<tr>
<th>Version</th>
<td><?php echo htmlentities($report->client_version) ?></td>
</tr>
<tr>
<th>OS Type</th>
<td><?php echo htmlentities($report->os_type) ?></td>
</tr>
<tr>
<th>OS String</th>
<td><?php echo htmlentities($report->os) ?></td>
</tr>
<tr>
<th>OS Version</th>
<td><?php echo htmlentities($report->os_version) ?></td>
</tr>
<tr>
<th>Graphics Card</th>
<td><?php echo htmlentities($report->gpu) ?></td>
</tr>
<tr>
<th>OpenGL Version</th>
<td><?php echo htmlentities($report->opengl_version) ?></td>
</tr>
<tr>
<th>Grid</th>
<td><?php echo htmlentities($report->grid) ?></td>
</tr>
<tr>
<th>Region</th>
<td><?php echo htmlentities($report->region) ?></td>
</tr>
<tr>
<th>Crash Reason</th>
<td><?php echo htmlentities($report->crash_reason . " at " . $report->crash_address . " thread " . $report->crash_thread) ?></td>
</tr>
</table>
<h3>Stack</h3>
<?php for ($threadID = 0; $threadID < count($report->threads); $threadID++): ?>
<table width="99%">
<tr>
<th width="20%">Thread <?php echo htmlentities($threadID . ($threadID == $report->crash_thread ? " (crashed)" : "")) ?></th>
<th>Function</th>
</tr>
<?php for ($frameID = 0; $frameID < count($report->threads[$threadID]->frames); $frameID++): $f = $report->threads[$threadID]->frames[$frameID]; ?>
<tr class="rowhighlight">
<td><?php echo htmlentities($f->module) ?></td>
<td><?php echo CrashReport::htmlFrame($f) ?></td>
</tr>
<?php endfor ?>
</table>
<br/><br/>
<?php endfor ?>
<h3>Loaded Modules</h3>
<table>
<tr>
<th>Name</th>
<th>Version</th>
</tr>
<?php for ($i = 0; $i < count($report->modules); $i++): ?>
<tr class="rowhighlight">
<td><?php echo htmlentities($report->modules[$i]->name) ?></td>
<td><?php echo htmlentities($report->modules[$i]->version) ?></td>
</tr>
<?php endfor ?>
</table>
<?php
Layout::footer();
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/

View File

@@ -83,6 +83,10 @@ th {
background: url(images/container-bg.gif) top repeat-x;
}
.hand {
cursor: pointer;
}
tr.rowhighlight:hover {
background-color: #2C3737;
}