Ticket #23 (assigned regression)

Opened 2 years ago

Last modified 1 year ago

The new disassembler has been converted incompletely

Reported by: Stadler Assigned to: bart (accepted)
Priority: trivial Milestone: 1.0
Component: eAccelerator Version: 0.9.5
Keywords: disassembler 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 (2.7 kB) - added by Stadler on 04/10/06 04:49:51.
dasm-php-menu-highlight.patch (21.2 kB) - added by Stadler on 04/11/06 22:32:24.

Change History

03/21/06 12:35:19 changed 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.

03/28/06 10:57:36 changed 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.

04/09/06 04:16:17 changed 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

04/09/06 05:27:22 changed 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.

04/09/06 05:30:05 changed by Stadler

in print_method:

shouldn't

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

be

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

?

04/09/06 07:33:34 changed 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.

04/10/06 01:13:51 changed 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?

04/10/06 03:36:13 changed 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.

04/10/06 04:49:51 changed by Stadler

  • attachment dasm.php.patch added.

04/10/06 04:51:57 changed 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

04/10/06 04:57:47 changed 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

04/11/06 13:43:26 changed 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.

04/11/06 22:32:24 changed by Stadler

  • attachment dasm-php-menu-highlight.patch added.

04/11/06 22:38:15 changed 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 :)

04/29/06 02:02:40 changed by anonymous

  • cc set to stadler@ragnarokonline.de.

05/04/06 15:26:57 changed 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?

05/04/06 17:40:08 changed 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.

05/04/06 17:46:51 changed by Stadler

  • cc deleted.

08/11/07 09:58:49 changed by 5tadler

  • keywords set to disassembler.