Csound Csound-dev Csound-tekno Search About

[Cs-dev] Added test for line numbers that fails

Date2014-08-03 15:23
FromAndres Cabrera
Subject[Cs-dev] Added test for line numbers that fails
AttachmentsNone  None  
Hi,

I've added a test for the parsing of orchestra line numbers into the TREE structure, and it is failing. It seems to me that after the first run, the line numbers are wrong. This is code completely alien to me, so I'd appreciate a look (this is causing some of my debugger tests to fail as they rely on line numbers...).

To avoid breaking Travis, I've pushed the minor changes to the orc_lines branch, and did a pull reuqest.

Thanks,
Andrés

Date2014-08-03 19:19
Fromjpff@cs.bath.ac.uk
SubjectRe: [Cs-dev] Added test for line numbers that fails
AttachmentsNone  

Date2014-08-03 19:41
FromAndres Cabrera
SubjectRe: [Cs-dev] Added test for line numbers that fails
AttachmentsNone  None  
Then why do the tests pass with 0?

Cheers,
Andrés


On Sun, Aug 3, 2014 at 1:19 PM, <jpff@cs.bath.ac.uk> wrote:
Why do you think that the value of tree->next->line should be 0?  It
is 5 which seems sane to me.

Quoting Andres Cabrera <mantaraya36@gmail.com>:

> Hi,
>
> I've added a test for the parsing of orchestra line numbers into the TREE
> structure, and it is failing. It seems to me that after the first run, the
> line numbers are wrong. This is code completely alien to me, so I'd
> appreciate a look (this is causing some of my debugger tests to fail as
> they rely on line numbers...).
>
> To avoid breaking Travis, I've pushed the minor changes to the orc_lines
> branch, and did a pull request.
>
> Thanks,
> Andrés




------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


Date2014-08-03 20:10
Fromjpff@cs.bath.ac.uk
SubjectRe: [Cs-dev] Added test for line numbers that fails
AttachmentsNone  

Date2014-08-03 21:33
FromAndres Cabrera
SubjectRe: [Cs-dev] Added test for line numbers that fails
AttachmentsNone  None  
That seems to be the issue. The issue seems to be errant and works sometimes, which points to an unitialized variable.

Maybe it should be set to 0 after the parsing of the orc file? All incoming realtime orchestra code should be considered to have offset 0.

And thinking more about it, since I'm using the API without an orc file, then this value might not be initialized at all.

Cheers,
Andrés


On Sun, Aug 3, 2014 at 2:10 PM, <jpff@cs.bath.ac.uk> wrote:
Longer response.  The initial line number is taken from
csound->orcLineOffset which is zero in Top/csound.c and set to the
first line of orc in Top/one_file.c to get line numbers in .csd files.
  In the csoundReset code there is no attempt to reset this value so
it remains from earlier.

I do not know about the reset code, where it is called or what else is
not initialised.


Quoting Andres Cabrera <mantaraya36@gmail.com>:

> Hi,
>
> I've added a test for the parsing of orchestra line numbers into the TREE
> structure, and it is failing. It seems to me that after the first run, the
> line numbers are wrong. This is code completely alien to me, so I'd
> appreciate a look (this is causing some of my debugger tests to fail as
> they rely on line numbers...).
>
> To avoid breaking Travis, I've pushed the minor changes to the orc_lines
> branch, and did a pull request.
>
> Thanks,
> Andrés




------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


Date2014-08-03 23:49
Fromjpff@cs.bath.ac.uk
SubjectRe: [Cs-dev] Added test for line numbers that fails
AttachmentsNone  

Date2014-08-04 14:02
Fromjpff@cs.bath.ac.uk
SubjectRe: [Cs-dev] Added test for line numbers that fails
AttachmentsNone  

Date2014-08-10 03:42
FromAndres Cabrera
SubjectRe: [Cs-dev] Added test for line numbers that fails
AttachmentsNone  None  
There still seems to be something funky with line numbers. The line number value is sometimes left unitialized by the orc parser. When running in the debugger, I see strange values, and valgrind reports:

==29347== Conditional jump or move depends on uninitialised value(s)
==29347==    at 0x4FEBDAE: opcode_perf_debug (csound.c:1599)
==29347==    by 0x4FEC43C: kperf_debug (csound.c:1734)
==29347==    by 0x4FEC998: csoundPerformKsmps (csound.c:1838)
==29347==    by 0x401BF8: test_line_breakpoint (csound_debugger_test.c:234)
==29347==    by 0x536D05F: ??? (in /usr/lib/libcunit.so.1.0.1)
==29347==    by 0x536D375: ??? (in /usr/lib/libcunit.so.1.0.1)
==29347==    by 0x536D69F: CU_run_all_tests (in /usr/lib/libcunit.so.1.0.1)
==29347==    by 0x402273: main (csound_debugger_test.c:366)

https://gist.github.com/mantaraya36/b1fd683d84d90e0cc75d

csound.c:1599 reads:
if (bp_node->line == linenum) { /* line matches */

so it is in fact the line number that hasn't been initialized.

The issue seems to occur in line 614 in csound_orc.y, where the LINE macro produces unitialized values.

          | exprlist ',' label
                {
                    /* $$ = make_node(',', $1, $3); */
                    $$ = appendToTree(csound, $1,
                                      make_leaf(csound, LINE,LOCN,
                                                LABEL_TOKEN, (ORCTOKEN *)$3));
                }
          | exprlist ',' error

Does this help?

Cheers,
Andrés




On Mon, Aug 4, 2014 at 8:02 AM, <jpff@cs.bath.ac.uk> wrote:

Quoting jpff@cs.bath.ac.uk:

> My last message got lost -- fixed in git
>
> Will explain tomorrow -- time to crash
>

In the message that got lost I explained that my previous message,
about initialising variables, was wrong.  The problem was that the
parser built the tree for an instrument at the _end_ of the instrument
(ie on endin) and that was the line it recorded.  A related oddity was
that if one defined an instrument which #included the endin, or as in
a macro it would also record the wrong file.

With a little fiddling about it now records the initial line/file.
Andres' test now runs.

==John ff


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel