1553 Commits

Author SHA1 Message Date
yossizap
ab38a9eb55 Fix not being able to return from debug when using WinDbg(DbgEng) ##debug 2020-11-10 12:22:09 +08:00
Anton Kochkov
aaccc09828 Variadic argument fixes 2020-11-10 11:11:45 +08:00
condret
965b0fa4e0 Implement first/last/next/prev fd APIs ##io 2020-11-01 11:33:31 +01:00
pancake
d08ea37ae9 Code cleanup in R_IO 2020-11-01 11:33:31 +01:00
GustavoLCR
0ca7d6c3c1 Add RIO on write event ##io 2020-11-01 02:12:14 +01:00
Roman Hargrave
5aff070b0f
Make use of dbg.args on *nix and macos (#17846)
As with the windbg implementation of fork_and_ptraceme, this checks for
the presence io->args and appends them to the child command before
invoking it.

The primary purpose of this fix is to make argument-passing possible
when using Cutter to debug programs, as Cutter sets dbg.args in order to
pass user-provided arguments to the child task. Presently, this does not
do anything on *nix platforms, greatly limiting Cutter's usefulness
insofar as debugging.
2020-10-26 13:56:59 +08:00
GustavoLCR
623c4819d6
Fix some warnings in WinDBG plugin (#17784) 2020-10-14 14:51:11 +08:00
Riccardo Schirone
1e58692071
Fix incorrect uses of printf-like functions ##refactor (#17648) 2020-10-13 16:26:15 +02:00
Riccardo Schirone
741d22ed61
Use -Werror when building in CI (#17781) 2020-10-13 12:42:57 +02:00
Florian Märkl
8fea09e21d
Use Ht instead of SDB for pcache ##io (#17716) 2020-09-27 12:22:18 +02:00
Florian Märkl
3f81a40844
Kill RIODesc.obsz ##io (#17715) 2020-09-27 10:01:23 +02:00
pancake
62c2128b6f
Better use of the R_SOCKET_PROTO_DEFAULT and add _NONE (#17644)
* Better use of the R_SOCKET_PROTO_DEFAULT and add _NONE ##http

* Fix regressions in: r2 -C and =+ ##r2pipe

Introduced in 04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9

* Implement sleep command ##shell

* Add tests for the webserver and remoting

* Implement daemon directive in rarun2, fix http test ##rarun2

* Fix socket timeout on Windows (patch by @GustavoLCR) ##socket

* Missing http.root is not a reason to not start the webserver ##http

* Fix r2 -C, =!=0, replace curl with r2 in the webserver test ##http

* Honor anal.in/from/to in aae, optimize db/formats/mach0/thumb ##anal

* Bug fixes and performance improvements

Co-authored-by: pancake <pancake@nopcode.org>
2020-09-25 19:51:23 +08:00
Khairul Azhar Kasmiran
d9057505dc
Set RPATH/RUNPATH on r2 libs too if local (#17639) 2020-09-15 09:16:14 +02:00
GustavoLCR
443fc06500
Fix wrong calling convetion in io_windbg.c (#17570) 2020-09-01 17:02:08 -05:00
pancake
b5b2daf69a
Fix warning not addressed in cef191cde31cbef1da12562cda91e629eabdde93 (#17456) 2020-08-26 11:01:56 +08:00
Zi Fan
0ba897f5c9
Add network support for WinDbg/KD (KDNET) ##debug (#17340)
* Add network support for WinDbg/KD (KDNET) ##debug
* Add iob_net io_backend plugin for shlr/winkd
* Add Windows 10 (May 2019 Update) build 18362 profile
* Add r_hash_do_hmac_sha256 function to r_hash
* Change r_socket_connect to bind source port for UDP connection
2020-08-26 10:24:20 +08:00
GustavoLCR
489538e02b
Add DbgEng based debug backend for Windows ##debug (#17491)
* Rename `windbg` plugin to `winkd` ##debug
* Add DbgEng based debug backend for Windows ##debug
2020-08-24 19:01:10 +08:00
GustavoLCR
bb3e80c040
Implement pde to disassemble following code execution ##disasm (#17410)
* Implement `pde` to disassemble following code execution
* Fix `asm.filter=1` with `scr.color=0`
* Fix cache not being used
* Share read and write file permissions on Windows
* Use CreateFileW in r_sandbox_open on Windows and fix file permissions
* Fix opening nul and O_RDWR
* File creation flags cannot be combined on Windows
* Share write in r_file_mmap_windows
2020-08-13 10:05:38 +08:00
David CARLIER
9ebbdd64ec
Enable is_pid_already_attached for NetBSD ##io (#17457)
Similar interface as OpenBSD
2020-08-13 09:55:54 +08:00
Anton Kochkov
5d5f8b6c69
Add missing PTRACE_GETSIGINFO for old glibc (#17416) 2020-08-08 01:39:15 +08:00
David CARLIER
2a00f5fee1
io_self: giving more meaningful mapping names when possible ##port (#17382)
using libproc to get proper mapping names to match better Linux version.
2020-08-03 12:37:38 +08:00
GustavoLCR
cef191cde3
Fix #14024 - Make r_io_map_get() faster (#17324) ##io
* Fix O(n) in r_io_map_get() ##io
* Kill `map_skyline_shadow` and `do_skyline`
2020-07-31 10:04:57 +02:00
Zi Fan
ac126508d5
Fix debugger to run debuggee with original environment variables ##debug (#17116)
* Change `fork_and_ptraceme` to start debuggee with rarun2 profile on Linux & Mac
* Add two new commands `doe` and `doe!` to show and edit rarun2 startup profile
* Fix `r_run_parse` to read last line
2020-07-24 16:25:55 +08:00
pancake
9cc1ce3c80
Fix wrong function signature in io.gdb (#17318)
Co-authored-by: pancake <pancake@nopcode.org>
2020-07-20 19:38:43 +08:00
Khairul Azhar Kasmiran
d970c64292
Move r2r diffchar code into r_util (#17316) 2020-07-20 00:44:27 +08:00
Riccardo Schirone
594b940b7c
Fixes some of the issues in Travis (#17267)
* Do not check with r_return_ if the convention is present

Let's just assume the NULL default in such a case, so that architectures
for which we don't have a defined calling convention can still be
processed somehow by the analysis code. It won't be precise, but it's
better than nothing.

Also add a warning message so users are aware when the calling
convention is not defined.

* Fix oob-read when # is at the end of the cmd string

* Do not set TMPDIR when the new value is the empty string

When TMPDIR is set to empty value, clang+ld behaves in weird ways and
you cannot compile files from within the r2 shell (e.g. when using #!c
or #!cpipe)

* Use meson and add -lasan to pkgconfig files when sanitizer are used
2020-07-16 20:47:30 +08:00
David CARLIER
74d5a677e1
io_self update DragonFly support and fix one typo. ##libr (#17274)
Applying patch from Dports.
Using higher level API rather than querying direct fields which are prone to changes.

Original author: @zrj-rimwis.
2020-07-14 21:57:30 +08:00
pancake
cccaf55a6c
Initial implementation of io.fd plugin ##io (#17158)
Useful for `self://` and r2frida when injecting the lib inside a target process

Co-authored-by: pancake <pancake@nopcode.org>
2020-07-08 11:28:08 +08:00
Riccardo Schirone
d6c9bd4542
Add support for binr/blob and fix android build ##meson ##build (#17150)
* Make sure meson can build with `system` = `android`.

* Add support for binr/blob in meson build

* Add also r_util as dependency

* Create sdb_version.py to get the SDBVER value from config.mk

* Set unknown sdb version if something fails
2020-07-05 10:53:37 +08:00
David CARLIER
5c71b01097
Support self:// for Solaris (#17196) ##io
enabled only on 64 bits unsupported on 32 bits with large files.
missing cfmakeraw function on this platform for socket et cons.
2020-07-03 18:59:24 +02:00
pancake
d47aed440a
Fix covs from 2020-06-29 (#17184)
* Fix covs from 2020-06-29

* CIDs: 1293553 1408695 1430058 1430059 1430060
1430061 1430062 1430063 1430064 1430065 1430067

* More fixes

Co-authored-by: pancake <pancake@nopcode.org>
2020-07-01 09:33:38 +08:00
GustavoLCR
043b0183bd
Fixes for windows debugger ##debug (#17151)
* Fixes memleaks
* Fix compiler warnings
* Fix warning when reopening file as debugger
* Improve exception logging
* Fix inconsistencies killing/restarting a process
* Fix detaching without killing debuggee
* Fix warning when continuing after receiving CONTROL-C
* Expose exception reason for 'di'
* Fix listing opened files with 'dd'
2020-06-30 10:48:08 +08:00
David CARLIER
f56ae25d35
Haiku OS - implement io_self ##libr (#17164)
Update debug thread wrapper and implement basic io_self plugin
2020-06-29 13:06:07 +08:00
David CARLIER
4d22e92d6d
Haiku build fix proposal (#17117) ##sys 2020-06-27 17:20:43 +02:00
pancake
bd9a604a87
Check for return values in about ~50 method calls (#17025) 2020-06-15 11:24:43 +02:00
pancake
160fc95e66
Use (void) instead of () in function signatures (#17026) ##refactoring
* Use (void) instead of () in function signatures
* Add test to avoid further contributions to commit the same mistake
2020-06-14 16:08:32 +02:00
Anton Kochkov
ffe743ef39
Fix #4056 - rename DEPS to R2DEPS ##build (#17020)
* Rename DEPS to R2DEPS
* Cleanup of sys/build.sh
2020-06-12 10:49:28 +08:00
pancake
75ee57bfb0
Update SDB with boolified SdbForeachCallback (#17040) 2020-06-11 11:25:23 +02:00
Riccardo Schirone
72f97959e8
Fix Tests after Reports by asan (#16776)
* Fix memory leak in IO
* Fix memory leak in cmd_api
* Remove unused variables in test_table
* Fix memory leak in test_flags
* Fix memory leak in test_list
* Fix memory leaks in test_anal_var
2020-05-08 21:45:01 +02:00
pancake
55f99ba4f4
Fix regression loading large files (>2GB) on 32bit systems ##io (#16648) 2020-04-28 22:09:30 +02:00
GustavoLCR
ac5355fb3d
Fixes for windows debugger - ##windows ##debug (#16717)
* Fix #15937 - Fix debuggee hanging when attaching to it
* Fix `dm` not working for attached processes
* Fix debuggee crashing when opening a file dialog
* Unify RIOW32Dbg and w32dbg_wrap_instance under W32DbgWInst
* Don't signal threads on select, only on continue
2020-04-26 11:54:36 +08:00
Liumeo
cc9b4a0063
Use ut64 in counter for gdb.write via LGTM (#16672) 2020-04-22 01:24:40 +02:00
pancake
315050e7ab Fix last coverities 2020-04-13 23:57:16 +02:00
Disconnect3d
1026faaf01 Fix off by one in "dr*" matching
The string literal `"dr*"` has a length of 3 so the strncmp used should have size argument of 3 instead of 2.

PS: I am not sure if this fix is correct but it seems so. If it is not, please close this PR. However, if the fix is incorrect it seems there could be some bug as next `else if` checks for `"dr"` too.
2020-04-13 20:23:17 +02:00
pancake
d0c0cf13a8 Boolify r_io_shift 2020-04-13 20:05:03 +02:00
pancake
54617455de
Initial refactoring of the rap:// protocol (-75 LOC) ##socket (#16534)
* It's implemented in IO, Socket and Core
* Remove duplicated apis and defines, everything in in RSocket now
* RIO now owns an RCoreBind instead of 3 fcn pointers + 1 void*
* Use proper filenames in libr/socket following public api names
* Use RSocket.block apis in the rap client + server apis
2020-04-12 16:40:55 +02:00
pancake
e9eb1a2ab3
Fix #16432 - openbsd fork+attach EBUSY issue ##debug (#16505)
* Implement is_pid_already_attached() for OpenBSD
2020-04-11 01:56:50 +02:00
Khairul Azhar Kasmiran
f31e6ca527
Fix #16283 - Continue as normal even if detachee is not found (#16500) 2020-04-09 23:07:03 +02:00
Florian Märkl
9a2effd5ed
Use RPVector for io->maps - speedup map traversal ##io
- The 64K section bin now loads in 15s instead of 26s
2020-04-07 12:43:41 +02:00
Riccardo Schirone
90d77e2a21
r_buffer: do not move seek when using _at APIs (#16401) ##util
This allows to use r_buf_read/r_buf_write to read/write sequentially but
at the same time having random reads/writes in the buffer if needed,
without the need to save/restore the seek every time.

* Fix some uses of r_buf_read_at/write_at that assumed seek change
2020-04-04 10:31:48 +02:00