Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion librz/cons/histogram.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,8 +691,14 @@ static void render_visual_xaxis_ruler(RzStrBuf *buf, const RzHistogramInteractiv
if (!tick_cols) {
return;
}
ut32 space;
if ((data_cols > (ut32)addr_w)) {
space = data_cols - addr_w;
} else {
space = 1;
}
for (int t = 0; t < ticks; t++) {
tick_cols[t] = (int)((ut64)t * (data_cols - 1) / (ticks - 1));
tick_cols[t] = (int)((ut64)t * space / (ticks - 1));
}
rz_strbuf_appendf(buf, "%*s", gutter_w, "");
next_tick = 0;
Expand Down
255 changes: 109 additions & 146 deletions test/db/cmd/cmd_interactive_modes
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
NAME=Internal less
FILE==
CMDS=<<EOF
e scr.interactive=false
pd 1~..
EOF
EXPECT_ERR=<<EOF
Internal less requires scr.interactive=true.
EOF
RUN

NAME=Hud mode
FILE==
CMDS=<<EOF
e scr.interactive=false
pd 1~...
EOF
EXPECT_ERR=<<EOF
Hud mode requires scr.interactive=true.
EOF
RUN

NAME=?** search
FILE==
CMDS=<<EOF
e scr.interactive=true
e scr.utf8=true
e scr.columns=120
e scr.rows=4
e scr.color=0
< \n; ?**
echo
echo
e scr.utf8=false
< \n; ?**
echo
EOF
NAME=Internal less
FILE==
CMDS=<<EOF
e scr.interactive=false
pd 1~..
EOF
EXPECT_ERR=<<EOF
Internal less requires scr.interactive=true.
EOF
RUN
NAME=Hud mode
FILE==
CMDS=<<EOF
e scr.interactive=false
pd 1~...
EOF
EXPECT_ERR=<<EOF
Hud mode requires scr.interactive=true.
EOF
RUN
NAME=?** search
FILE==
CMDS=<<EOF
e scr.interactive=true
e scr.utf8=true
e scr.columns=120
e scr.rows=4
e scr.color=0
< \n; ?**
echo
echo
e scr.utf8=false
< \n; ?**
echo
EOF
EXPECT=<<EOF
[?25l0> | 0> |
- │ !<command> [<args1> <args2> ...] # Run command via system(3) with raw output. Grepping via '~' automatically forces
Expand All @@ -46,39 +46,39 @@ EXPECT=<<EOF
use of '!!' instead.
| !!<command> [<args1> <args2> ...] # Run command via system(3) and pipe its stdout to rizin [?25h
EOF
RUN

NAME=?** entire help string on match
FILE=--
CMDS=<<EOF
e scr.interactive=true
e scr.utf8=true
e scr.columns=100
e scr.rows=3
e scr.color=0
< f\n; ?**
echo
EOF
RUN
NAME=?** entire help string on match
FILE=--
CMDS=<<EOF
e scr.interactive=true
e scr.utf8=true
e scr.columns=100
e scr.rows=3
e scr.color=0
< f\n; ?**
echo
EOF
EXPECT=<<EOF
[?25l0> | 0> |
- │ !<command> [<args1> <args2> ...] # Run command via system(3) with raw output. Grepping via '~'
automatically forces use of '!!' instead. 0> f| 0> f|
- │ !<command> [<args1> <args2> ...] # Run command via system(3) with raw output. Grepping via '~'
automatically Forces use oF '!!' instead. [?25h
EOF
RUN

NAME=?** wrapping
FILE=--
CMDS=<<EOF
e scr.interactive=true
e scr.utf8=true
e scr.columns=100
e scr.rows=5
e scr.color=0
< q\n; ?**
echo
EOF
RUN
NAME=?** wrapping
FILE=--
CMDS=<<EOF
e scr.interactive=true
e scr.utf8=true
e scr.columns=100
e scr.rows=5
e scr.color=0
< q\n; ?**
echo
EOF
EXPECT=<<EOF
[?25l0> | 0> |
- │ !<command> [<args1> <args2> ...] # Run command via system(3) with raw output. Grepping via '~'
Expand All @@ -90,37 +90,37 @@ EXPECT=<<EOF
│ %lQ <str> # Calculate length of string <str>. Quiet mode stores value in `$?`
register. (Quiet mode) [?25h
EOF
RUN

NAME=?**e search
FILE==
CMDS=<<EOF
e scr.interactive=true
e scr.utf8=true
e scr.columns=120
e scr.rows=3
e scr.color=0
< \n; ?**e
echo
EOF
RUN
NAME=?**e search
FILE==
CMDS=<<EOF
e scr.interactive=true
e scr.utf8=true
e scr.columns=120
e scr.rows=3
e scr.color=0
< \n; ?**e
echo
EOF
EXPECT=<<EOF
[?25l0> | 0> |
- analysis.apply.signature: bool - enables/disables auto-applying signatures to the loaded binary (see also flirt
analysis.arch: string,bind - Select the architecture to use [?25h
EOF
RUN

NAME=?*** search
FILE==
CMDS=<<EOF
e scr.interactive=true
e scr.utf8=true
e scr.columns=100
e scr.rows=6
e scr.color=0
< %l\n; ?***
echo
EOF
RUN
NAME=?*** search
FILE==
CMDS=<<EOF
e scr.interactive=true
e scr.utf8=true
e scr.columns=100
e scr.rows=6
e scr.color=0
< %l\n; ?***
echo
EOF
EXPECT=<<EOF
[?25l0> | 0> |
- ! | Usage: !<command> [<args1> <args2> ...] # Run command via system(3) with raw output.
Expand All @@ -139,21 +139,21 @@ EXPECT=<<EOF
%L | │ %Lq <str> # Calculate length of string <str>. Quiet mode stores value in `$?` register.
%L | (quiet mode) [?25h
EOF
RUN

NAME=p==v visual histogram interactive (#4431 regression)
FILE=malloc://512
CMDS=<<EOF
e scr.interactive=true
e scr.utf8=true
e scr.columns=80
e scr.rows=12
e scr.color=0
e scr.hist.minimap=true
wx 00112233445566778899aabbccddeeff @ 0
< lq; p==v
echo END
EOF
RUN
NAME=p==v visual histogram interactive (#4431 regression)
FILE=malloc://512
CMDS=<<EOF
e scr.interactive=true
e scr.utf8=true
e scr.columns=80
e scr.rows=12
e scr.color=0
e scr.hist.minimap=true
wx 00112233445566778899aabbccddeeff @ 0
< lq; p==v
echo END
EOF
EXPECT=<<EOF
[?25l ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓

Expand All @@ -164,8 +164,8 @@ EXPECT=<<EOF
85│█
│█
0│▲██████████████████████████████████████████████████████████████████████████
^ ^ ^ ^ ^ ^ ^ ^ ^
0x0 0x0 0x0 0x0 0x0 0x100 0x100 0x100 0
^ ^ ^ ^ ^ ^ ^ ^ ^
0x0 0x0 0x0 0x0 0x0 0x100 0x100 0x100 0x100
Index 0 data 0 0x0 0%[?25l ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

255│ ▼
Expand All @@ -175,45 +175,8 @@ Index 0 data 0 0x0 0%
85│ █
│ █
0│█████████████████████████████████████▲█████████████████████████████████████
^ ^ ^ ^ ^ ^ ^ ^ ^
0x0 0x0 0x0 0x0 0x0 0x100 0x100 0x100 0
^ ^ ^ ^ ^ ^ ^ ^ ^
0x0 0x0 0x0 0x0 0x0 0x100 0x100 0x100 0x100
Index 1 data 0 0x100 100%[?25hEND
EOF
RUN

NAME=data xrefs outside functions marked as data
FILE=bins/elf/analysis/mipsbe-ip
CMDS=<<EOF
e scr.utf8=false
e scr.color=0
aaa
s 0x4350f8
< q ; Vp
echo END
EOF
EXPECT=<<EOF
[?25l[0x004350f8 [xAdvc]0 90% 115 bins/elf/analysis/mipsbe-ip]> pd $r @ data.004350f8
; XREFS(69)
;-- data.004350f8:
0x004350f8 .dword 0x00430000
; DATA XREF from fcn.004020d0 @ 0x402108
;-- data.004350fc:
0x004350fc .dword 0x00435420 ; section..sdata
; DATA XREF from fcn.004020d0 @ 0x402120
;-- data.00435100:
0x00435100 .dword 0x0043396c ; obj.__DTOR_END
; XREFS(156)
;-- data.00435104:
0x00435104 .dword 0x00420000 ; str.ute_get_ADDRESS___from_ADDRE
; DATA XREF from sym._init @ 0x402024
; DATA XREF from sym._fini @ 0x41ecd0
;-- data.00435108:
0x00435108 .dword 0x00400000 ; segment.LOAD0 ; segment.ehdr
0x0043510c .dword 0x00000000
0x00435110 .dword 0x00000000
0x00435114 .dword 0x00000000
0x00435118 .dword 0x00000000
; DATA XREF from fcn.00414700 @ +0xbb0
; DATA XREF from sym.rtnl_open_byproto @ 0x41a878 0.0%[?25hEND
EOF
RUN
RUN
Expand Down
Loading