Thanks to visit codestin.com
Credit goes to github.com

Skip to content

B::Concise doesn't entirely honour walk_output() #24024

@tonycoz

Description

@tonycoz

Module: B::Concise

Description

Besides the use via -MO, B::Concise has an API which can be used from runtime code to dump op trees with a bit more control.

This includes a function walk_output() which is meant to set the output of the dump.

One function writes to the wrong place.

Steps to Reproduce

 ~/perl/v5.42.0-threads/bin/perl -mB::Concise -e 'sub f { return shift; } my $buf; B::Concise::walk_output(\$buf) or die; my $w = B::Concise::compile("-concise", "-stash=main"); $w->(); $buf =~ s/^/ > /gm; print $buf'
FUNC: *main::f
 > 3  <1> leavesub[1 ref] K/REFC,1 ->(end)
 > -     <@> lineseq KP ->3
 > 1        <;> nextstate(main -8 -e:1) v ->2
 > -        <@> return K ->-
 > -           <0> pushmark s ->2
 > 2           <0> shift s* ->3
 > y  <@> leave[1 ref] vKP/REFC ->(end)
 > 4     <0> enter v ->5
 > 5     <;> nextstate(main -7 -e:1) v:{ ->6
 > 6     <0> padsv[$buf:-7,-5] vM/LVINTRO ->7
 > 7     <;> nextstate(main -6 -e:1) v:{ ->8
...

Note that the FUNC: *main::fline isn't captured in $buf

Expected behavior
All of the output, including the FUNC: *main::f line is written to $buf

Perl configuration

Summary of my perl5 (revision 5 version 42 subversion 0) configuration:
   
  Platform:
    osname=linux
    osvers=6.12.43+deb13-amd64
    archname=x86_64-linux-thread-multi
    uname='linux ares 6.12.43+deb13-amd64 #1 smp preempt_dynamic debian 6.12.43-1 (2025-08-27) x86_64 gnulinux '
    config_args='-des -Dprefix=/home/tony/perl/v5.42.0-threads -Accflags=-march=native -Dusethreads'
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=define
    usemultiplicity=define
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
  Compiler:
    cc='cc'
    ccflags ='-D_REENTRANT -D_GNU_SOURCE -march=native -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
    optimize='-O2'
    cppflags='-D_REENTRANT -D_GNU_SOURCE -march=native -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion=''
    gccversion='14.2.0'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='cc'
    ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/x86_64-linux-gnu /usr/lib /usr/lib64
    libs=-lpthread -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc
    libc=/lib/x86_64-linux-gnu/libc.so.6
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.41'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC'
    lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'


Characteristics of this binary (from libperl): 
  Compile-time options:
    HAS_LONG_DOUBLE
    HAS_STRTOLD
    HAS_TIMES
    MULTIPLICITY
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_HASH_FUNC_SIPHASH13
    PERL_HASH_USE_SBOX32
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_USE_SAFE_PUTENV
    USE_64_BIT_ALL
    USE_64_BIT_INT
    USE_ITHREADS
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_PERLIO
    USE_PERL_ATOF
    USE_REENTRANT_API
    USE_THREAD_SAFE_LOCALE
  Built under linux
  Compiled at Dec 18 2025 20:40:39
  @INC:
    /home/tony/perl/v5.42.0-threads/lib/site_perl/5.42.0/x86_64-linux-thread-multi
    /home/tony/perl/v5.42.0-threads/lib/site_perl/5.42.0
    /home/tony/perl/v5.42.0-threads/lib/5.42.0/x86_64-linux-thread-multi
    /home/tony/perl/v5.42.0-threads/lib/5.42.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions