Commit graph

63 commits

Author SHA1 Message Date
radare
9e08da0fa6
Improve build of libr.a and libr.dylib, fix and improve sys/ios-sdk.sh (#10046)
- Update spp and force hidden visibility
- Use R_API wisely
- RSys.prefix returns const things
- Use -install_name on Apple
- Fix merged lib visibility linking on Linux
- Use OSTYPE instead of BUILD_OS
- Honor crosscompiler-objcopy and support android like linux
- Add extra missing archives
- Fix for android
- Upgrade spp and sdb
- Skip libr. from symstall
- Add --enable-merged configure option
- Use --enable-merged on ios-sdk
- Upgrade sdb again for js0n
- Kill sys/ios-shell.sh
- Msvc dynamic build fix
2018-05-09 23:31:52 +02:00
Fangrui Song
320a2d5a58 Add FUNC_ATTR_USED and fix some warnings (#9413) 2018-02-17 20:19:33 -06:00
pancake
4e44e8e18e Fix compilation warnings on Linux 2018-02-09 18:45:54 +01:00
Khairul Kasmiran
9484bdb622 Fixed r_debug_native_reg_profile const qualifier warning 2017-12-31 20:59:52 +08:00
Khairul Kasmiran
0c048b2774 Moved some static prototypes into their source file 2017-12-20 22:38:20 +08:00
pancake
b07653dbe3 Fix #8751 - Infinite loop when a signal is received in the middle of a step-over 2017-10-31 14:28:08 +01:00
Fangrui Song
d9608fe186 Support powerpc64 PTRACE_GETREGS (#8529)
On BSD, addr and data are swapped. But on Linux, only SPARC strays.

Goodbye SPARC and Solaris.
2017-09-16 02:33:52 +02:00
pancake
ac63497b5a Remove harmless attach warning and support sparc in get/set-regs 2017-09-15 13:08:16 +02:00
xarkes
c1f6b29e8e Windbg code cleaning 2017-08-08 18:45:11 +02:00
leberus
f3d11405e7 Fix debug for Linux 2017-08-02 14:49:56 +02:00
Srimanta Barua
8c6a05dd58 Add reporting of debug info (#7941) 2017-07-17 11:39:34 +02:00
pancake
cda1873ee7 Fix linux build 2017-04-10 01:37:56 +02:00
davidpolverari
1fb422b532 Fix #6162 - Renames r_str_concat to r_str_append 2017-03-16 22:29:49 +01:00
pancake
f82930fd75 Fix latest covs 2017-03-15 12:12:55 +01:00
pancake
6eff81c201 Those ones too 2017-03-13 03:53:27 +01:00
pancake
91016693cb Avoid 100% cpu usage in Linux debugger 2017-03-08 12:31:43 +01:00
leberus
4fd1e990d9 Add: coredump refactoring + RDebugMap offset field (#6633) 2017-02-01 22:17:59 +01:00
leberus
82f282c629 Add: dbg.libs/unlibs for linux (#6567) 2017-01-24 20:22:36 +01:00
pancake
41602c4212 Fix android build 2017-01-18 13:46:39 +01:00
leberus
286ca4d0ed Add: support for dbg.follow.child option (#6525) 2017-01-18 00:40:30 +01:00
leberus
f4b8fbbc77 Fix: remove linux specific and add braces 2017-01-16 12:22:24 +01:00
pancake
2a83f21a3e Make gcc6 warnings happy 2017-01-15 22:02:57 +01:00
leberus
dc5be7a767 Improving debug on linux (#6435) 2017-01-11 17:39:09 +01:00
leberus
8b0afcbc39 Fix: #4856 #4857 (#6365) 2016-12-28 16:02:05 +01:00
pancake
50d73d1547 Fix a lot of memleaks, null derefs and undef behaviour thanks to clang-analyzer 2016-12-19 16:44:51 +01:00
Eugene
4530585132 Refactoring fixes in debug/linux (#6339) 2016-12-18 12:20:31 +01:00
pancake
6296f4b794 Add option to stop syscall tracing -before- the syscall is executed 2016-12-09 22:19:47 +01:00
leberus
e82a638006 Fix: #6278 (#6280) 2016-12-03 19:00:29 +01:00
pancake
7a68fd2d82 Attempt to fix the register profile reloading issue 2016-11-14 15:59:50 +01:00
SkUaTeR
4c2a01d4a7 Fix in profile to get correct reg.size (#6238) 2016-11-21 23:13:59 +01:00
pancake
490d2a498a Fix #2571 - dcs is working again 2016-09-26 13:40:25 +02:00
pancake
a86ae89f1d Fix syntax error from termux 2016-09-19 12:39:00 +02:00
dromero
20ed81af73 Fixing debugging problems at MIPS (32bits) (#5800) 2016-09-19 02:10:43 +02:00
Joshua J. Drake
09435c7317 Don't print SIGTRAP signals or stops
A TRAP signal signifes expected stops for breakpoints and so on. There's no
need to display these as signals or stops since they will be communicated
inside r_debug_bp_hit.
2016-07-01 21:32:02 -05:00
pancake
b53a99aca2 Mark some x86-specific code only for x86 2016-06-26 03:56:08 +02:00
pancake
dcc02e87c5 More if DEBUGGER for linux 2016-06-25 18:48:26 +02:00
pancake
feff5b59e4 Do not use %p for ut64 values 2016-06-22 19:20:59 +02:00
Joshua J. Drake
722c62827b Major rework to the native debugger (esp on Linux) (#5185)
The major contribution here is completely re-worked breakpoint hit/recoil
handling. This work fixes #4907 and lays the ground work for future native
debugger improvements (multi-threading, etc).

* Give a human friendly type to enums
* Change many wait functions to return RDebugReasonType
* Better return checking (from r_debug_reg_sync, r_bp_restore)
* Optimized register synchronization
* Lots of comments and whitespace changes
* Improved inferior death detection

Handle EXIT_PID events differently than DEAD process events

* Move breakpoint/recoil handling to wait/cont/step

Rather than handing breakpoint related things inside cmd_debug.c, do that
inside the r_debug API functions. This seems like the most logical place for it
to live since it should apply to just about any platform/architecture.  This
also centralizes calling into "cmd.bp" handling via the CoreBind callback.

* Track how the caller wishes to continue

It turns out that handling break point recoils is very complicated. The ptrace
API on Linux returns SIGTRAP for just about every type of operation (not just
breakpoints getting hit). Add the "recoil_mode" flag to indicate whether we are
single-stepping or continuing and whether or not we are inside the recoil.

* Proper handling for swstep=true

Since r_debug_step_soft calls r_debug_continue, it's already hitting the recoil
case there. Move the recoil handling from r_debug_step to r_debug_step_hard
only.

For the swstep=true case, special handling is required inside r_debug_recoil.
By resetting all of the breakpoints except the one we just hit, we ensure we
can step the original instruction and hit the new swstep breakpoint. Add a new
bp function called r_bp_restore_except to do this.

To make matters worse, we cannot use a BreakpointItem pointer because that
leads to a use-after-free condition. Instead, we the breakpoint address
instead.

Now breakpoints should work regardless of the swtep setting.

* Always call the recoil before continuing

Some callers of r_debug_continue might not have ever inserted any breakpoints
before. If we don't restore breakpoints before each call to the underlying
continue we won't hit them.

* Hide software step breakpoint events from the user

When a breakpoint even happens due to a software-step, hide it from the user.
They aren't really breakpoints as far as they are concerned.

* Improve process exit handling on Linux

There are three types of process exiting events on Linux:

1. PTRACE_EVENT_EXIT occurs just before a process exits. It's not possible to
prevent it from exiting, but it can be used to inspect the pre-exit state.
2. The process can exit for a variety of reasons and we can notice when we call
waitpid(2).
3. The process could die randomly on us :-/

On Windows, h->wait will return R_DEBUG_REASON_EXIT_PID, but it's more likely
on Linux to find out the process is already dead.

* Check more bits within waitpid status

We can often make a decision about what happened strictly by looking at the
status returned from waitpid. In other cases, we need to call
r_debug_handle_signals.

If we reach the end of this function without knowing what happened, consider it
an error.
2016-06-22 10:34:45 +02:00
pancake
55e0804d1d Fix some null-terminated strings issues in the procfs parsing 2016-06-20 18:22:25 +02:00
Joshua J. Drake
16c27891a0 Switch to r_sys_perror for errors and fix two typos 2016-06-20 15:24:19 +02:00
Joshua J. Drake
9c21df9272 Minor cleanups to process handling (#5152)
* Fixed 'dpk' handling (signal wasn't being groked)
* Mostly comments added
* Some eprintfs added
2016-06-17 01:59:10 +02:00
Joshua J. Drake
fb820f9c8e Fixes #4875: Refactor process listing (#5144)
* Fixes #4875: Refactor process listing
* Move procfs-based process listing into linux_debug.c, guarded by __linux__
* Provide a warning and eprintf a TODO on the remaining platforms.
* Break reusable parts into linux_get_proc_pid and call it as needed.
* Add/remove comments for clarity
* Address feedback and re-enable non-Linux
2016-06-16 22:39:11 +02:00
pancake
8d9e4a7836 Fix double close in thread-list and non-null terminated string in debug.linux.core 2016-06-14 03:10:47 +02:00
Oscar Salvador Vilardaga
876f3fd547 Initial coredump support for Linux-x86-64 (no threads yet)
* http://man7.org/linux/man-pages/man5/core.5.html
* Able to dump the header and the program headers
* Checks /proc/[pid]/coredump_filter to know which maps should be dumped
* Check for bit 6 to 0 (priv/share anon mappings, priv/share file-backed, elf hdr, priv/share huge pages)
* Missing: priv/share DAX pages
2016-05-21 12:27:13 +02:00
pancake
48d5e668eb No more linux-ppc blindfixing. This one is for real 2016-05-19 16:21:57 +02:00
pancake
b3093c516c Blind fix the powerpc debugger build 2016-05-16 08:37:40 +02:00
pancake
b9eca47b02 Add regprofile for linux-powerpc (via @crowell) 2016-04-28 14:37:29 +02:00
pancake
d24bc909ec Update sdb for osx-ppc and other 0.10.2 updates 2016-04-27 00:25:28 +02:00
andrey.torsunov
169f3885c3 Fix checking /proc/%d/task for existence.
Since `/proc/%d/task` is directory, it make sense to use appropriate
check function. Therefore,`r_file_exists` function is not suitable
here, because it checks for existence of regular file.
2016-04-22 13:55:19 +02:00
Jeffrey Crowell
9a77bdc7d5 fix r_debug_reg_get to use PC instead of pc in dbg 2016-04-11 12:26:33 -04:00