Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 318331
Collapse All | Expand All

(-)a/src/dbg/unix/debug.c (-11 / +9 lines)
Lines 98-106 Link Here
98
}
98
}
99
#endif
99
#endif
100
100
101
int debug_os_kill(int pid, int sig)
101
int debug_os_kill(int pid, int sig) {
102
{
103
	//return 0;
104
	/* prevent killall selfdestruction */
102
	/* prevent killall selfdestruction */
105
	if (pid < 1)
103
	if (pid < 1)
106
		return -1;
104
		return -1;
Lines 115-122 Link Here
115
#include <sys/uio.h>
113
#include <sys/uio.h>
116
#include <sys/ktrace.h>
114
#include <sys/ktrace.h>
117
115
118
int debug_ktrace()
116
int debug_ktrace() {
119
{
120
#if __OpenBSD__ || __FreeBSD__
117
#if __OpenBSD__ || __FreeBSD__
121
	eprintf("No fktrace for OpenBSD. Needs to be implemented with ktrace(2)\n");
118
	eprintf("No fktrace for OpenBSD. Needs to be implemented with ktrace(2)\n");
122
#else
119
#else
Lines 142-155 Link Here
142
	ret = arch_continue();
139
	ret = arch_continue();
143
	ret = read (pd[0], buf, 1);
140
	ret = read (pd[0], buf, 1);
144
	if (ret>0) {
141
	if (ret>0) {
145
		kill(ps.tid, SIGSTOP);
142
		debug_os_kill(ps.tid, SIGSTOP);
146
		printf("Have sweet dreamz my lil pon1e!!1!\n");
143
		printf("Have sweet dreamz my lil pon1e!!1!\n");
147
144
148
		ret = fktrace(pd[1], KTROP_CLEAR, trp, ps.tid);
145
		ret = fktrace(pd[1], KTROP_CLEAR, trp, ps.tid);
149
		ret |= fktrace(pd[1], KTROP_CLEARFILE, trp, ps.tid);
146
		ret |= fktrace(pd[1], KTROP_CLEARFILE, trp, ps.tid);
150
		printf("<fktrace> %d\n", ret);
147
		printf("<fktrace> %d\n", ret);
151
148
152
		ret = kill(ps.tid, 0);
149
		ret = debug_os_kill(ps.tid, 0);
153
		printf("<kill0> %d (alive)\n", ret);
150
		printf("<kill0> %d (alive)\n", ret);
154
151
155
		ret = wait(&sta);
152
		ret = wait(&sta);
Lines 398-403 Link Here
398
395
399
static int is_alive(int pid)
396
static int is_alive(int pid)
400
{
397
{
398
	if (pid<1)
399
		return 0;
401
	return kill (pid, 0)==0;
400
	return kill (pid, 0)==0;
402
}
401
}
403
402
Lines 460-468 Link Here
460
		/* restore breakpoints */
459
		/* restore breakpoints */
461
		debug_bp_reload_all();
460
		debug_bp_reload_all();
462
461
463
		if (config_get("dbg.stop")) 
462
		if (config_get("dbg.stop"))
464
			kill(ps.pid, SIGSTOP);
463
			debug_os_kill (ps.pid, SIGSTOP);
465
466
		ps.steps  = 1;
464
		ps.steps  = 1;
467
	}
465
	}
468
466
Lines 830-836 Link Here
830
		debug_msg_set("process %d finished\n", ps.tid);
828
		debug_msg_set("process %d finished\n", ps.tid);
831
		eprintf("\n\n______________[ process finished ]_______________\n\n");
829
		eprintf("\n\n______________[ process finished ]_______________\n\n");
832
		//ps.opened = 0;
830
		//ps.opened = 0;
833
		kill(ps.tid, SIGKILL);
831
		debug_os_kill (ps.tid, SIGKILL);
834
		sleep(1);
832
		sleep(1);
835
		eprintf("Use !load or ^C to reload\n");
833
		eprintf("Use !load or ^C to reload\n");
836
		config.interrupted=1;
834
		config.interrupted=1;

Return to bug 318331