Ticket #23 (closed regression: fixed)

Opened 4 years ago

Last modified 9 months ago

The new disassembler has been converted incompletely

Reported by: Stadler Owned by: bart
Priority: trivial Milestone: 1.0
Component: eAccelerator Version: 0.9.5
Keywords: Cc:

Description

The new disassembler a huge step back compared to the old one.

So far I'm missing the following features:

  • Compiled variables
  • Coloring (something, like $oplinecolor?, $oplineopcode_color? and so on would be nice
  • No codelines are being displayed (in the old version I could see the relevant code for the oplines, but now it has been removed, which make it hard to find out, which opline belongs to which part of the original code. I guess the old code for that was around  line 414 to 422 of webui.c)

Without these features the new disassembler is somewhat useless to me.

PS: It would be nice, if someone could add the type 'Regression' and change the type of this bug to it.

Regards,

Christian Stadler

Attachments

dasm.php.patch Download (2.7 KB) - added by Stadler 4 years ago.
dasm-php-menu-highlight.patch Download (21.2 KB) - added by Stadler 4 years ago.

Change History

comment:1 Changed 4 years ago by bart

  • Owner changed from somebody to bart
  • Status changed from new to assigned
  • Type changed from defect to regression

Yes, I'm aware of that. A bit of information needs to be returned by the eAccelerator code, but most stuff can be done in the php page.

comment:2 Changed 4 years ago by bart

Can you take a look at the current version? I've added source code and changed the looks a bit. The compiled variables and color coding haven't been added yet.

comment:3 Changed 4 years ago by anonymous

<?php
    if (!isset($_GET['file']) && is_file($_GET['file'])) {
        die('File argument not given!');
    }
?>

Should be

<?php
    if (!isset($_GET['file']) || !is_file($_GET['file'])) {
        die('File argument not given!');
    }
?>

I guess.

Regards,

Christian Stadler

comment:4 Changed 4 years ago by Stadler

And you should replace

<?php
echo "<div style=\"text-align: left; widht: 800px\"><ul>\n";
?>

with

<?php
echo "<div style=\"text-align: left; width: 800px\"><ul>\n";
?>

twice. You spelled width wrong.

comment:5 Changed 4 years ago by Stadler

in print_method:

shouldn't

<?php
echo "<h4>Method: $name</h4>";
?>

be

<?php
echo "<h2>Method: $name</h2>";
?>

?

comment:6 Changed 4 years ago by Stadler

The following doesn't work quite right:

    <?php
                $count = count($op_array);
                $line = 0;
                global $source;
                $last_line = 0;
                for ($i = 0; $i < $count; ++$i) {
                        $curr_line =  $op_array[$i]['lineno'];
                        /* find the next line that differs, but only when the start line differs from the previous */
                        $print = $line;
                        if ($last_line < $curr_line) {
                                for ($j = $i + 1; $j < $count; ++$j) {
                                        if ($op_array[$j]['lineno'] > $curr_line) {
                                                $print = $op_array[$j]['lineno'] - 1;
                                                break;
                                        }
                                }
                        }
                        $code = '';
                        while($line < $print) {
                                $code .= sprintf("%03d: %s\n", ($line + 1), $source[$line]);
                                ++$line;
                        }
                        if ($code != '') {
                                echo "<tr>\n";
//                              echo '<td  class="source" colspan="6"><pre>' . highlight_string($code, true) . "</pre></td>\n";
                                echo '<td  class="source" colspan="6"><pre>' . $code . "</pre></td>\n";
                                echo "</tr>\n";
                        }
        ?>

At the beginning everything looks fine (the correct code is above the oplines), but later on the oplines respectively the code are misplaced.

For example, when you display dasm.php with itself to problem starts around line 96 (Opline 129). The fact, that $last_line never changes may be one of the causes, but I'm too tired to do more debugging.

PS: dasm.php should have HTTP_AUTH too. Otherwise anyone could access it and read files, he shouldn't read.

comment:7 Changed 4 years ago by bart

I know putting the code between the opcodes goes wrong sometimes. I've been debugging this and it looks like the opcodes are placed on the lines the zend_engine put's in the op_array. The old disassembler also does this to. Am I wrong here?

comment:8 Changed 4 years ago by Stadler

I'll see, if I find a solution now.

btw: I've added $op_array[$i]lineno? to the table (column-title: Line) perhaps this could be the default?

PS: How about adding the method-list to print_layout and place it on the top of every page of dasm.php? This would make print_class redundant and you could navigate through the script layout on every page.

Changed 4 years ago by Stadler

comment:9 Changed 4 years ago by Stadler

I got it (I think). See the attached patch.

Additionally it adds $op_array[$i]lineno? to the table and it replaces the 'and' with an 'or' in the check for the file argument.

Regards,

Christian Stadler

comment:10 Changed 4 years ago by Stadler

btw: If you want the codelines to be highlighted, you should take a look at  http://aidanlister.com/repos/v/PHP_Highlight.php

comment:11 Changed 4 years ago by bart

I've included the patch in r198. You can implement the menu stuff and the source highlighting. I'll include it, it would be great to have those things.

Changed 4 years ago by Stadler

comment:12 Changed 4 years ago by Stadler

You can implement the menu stuff and the source highlighting. I'll include it, it would be great to have those things.

Done (See the attachment). And I've removed some redundant code.

btw: You should mention Aidan Lister <aidan [ett] php [dutt] net> in the AUTHORS-file. perhaps under a new section called 'Other contributors' for his great highlighter :)

comment:13 Changed 4 years ago by anonymous

  • Cc stadler@… added

comment:14 Changed 4 years ago by bart

This patch is added in revision [206] It's a very nice improvement! Is the new disassembler complete now? Or do you need some other stuff to?

comment:15 Changed 4 years ago by Stadler

  • Priority changed from blocker to trivial
  • Milestone changed from 0.9.5 to 1.0

Well, coloring and compiled variables are still missing, but that isn't so important and could be solved in a future Release.

Changing milestone and priority.

comment:16 Changed 4 years ago by Stadler

  • Cc stadler@… removed

comment:17 Changed 9 months ago by hans

  • Status changed from assigned to closed
  • Resolution set to fixed

compiled vars are shown in the current dasm, and i don't know what you mean by coloring, so i guess i'm closing this one.

Note: See TracTickets for help on using tickets.