All of lore.kernel.org
 help / color / mirror / Atom feed
* getting false SIGTRAP breakpoints in kernel i.e. kernel hung unless gdb remotely attached on x86 & cont is issued
@ 2008-09-17 13:47 Denis Joseph Barrow
  2008-09-17 13:55 ` Jason Wessel
  0 siblings, 1 reply; 10+ messages in thread
From: Denis Joseph Barrow @ 2008-09-17 13:47 UTC (permalink / raw)
  To: Amit S. Kale, Tom Rini, Jason Wessel, David Grothe,
	Tigran Aivazian, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 961 bytes --]

Hi ladies/gentlemen,
The kernel I'm running gdb with is 2.6.27-rc4
The false sigtrap is occuring in ia32_sysenter_target in arch/x86/kernel/entry_32.S:303
when gdb is stepped from the user process as described below

To reproduce
compile kernel with kgdb support 
compile my randsleep program attached using the .mk script
as root
attach randsleep to an idle serial port e.g. /dev/ttyS0 by typing
randsleep /dev/ttyS0
from another bash shell type
ps -aux | grep randsleep

gdb ./randsleep
attach <pid of randsleep>

You should get messages from gdb like
Attaching to program: /home/djbarrow/devel2/randsleep/randsleep, process 6397
Reading symbols from /lib/tls/i686/cmov/libc.so.6...done.
Loaded symbols for /lib/tls/i686/cmov/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
0xb7fda430 in __kernel_vsyscall ()

Now type step.

The machine is now hung until gdb attaches remotely.


-- 
best regards,
D.J. Barrow

[-- Attachment #2: randsleep.c --]
[-- Type: text/x-csrc, Size: 1647 bytes --]

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/time.h>
#include <time.h>  
#include <signal.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>

#define READLEN (128)
void sigalrm(int signal)
{
	fprintf(stderr,"atcmd_response_read timed out.\n");
	exit(-1);
}
void atcmd_response_read(int fd)
{
	int i,count;
	char tmpbuf;
	//alarm(5);
	for (i=0;;i++) {
		count=read(fd,&tmpbuf,1);
		if (count < 0) {
			perror("read failed\n");
			exit(-1);
		}

		if (count == 1 )
		{
			printf("%c",tmpbuf);
			if( i > 2&& (tmpbuf==0xd || tmpbuf==0xa))
				break;
		}
	}
	fflush(stdout);
	alarm(0);
}

void atcmd_write(int fd, char *buf)
{
	ssize_t written=0,retval;
	size_t count=strlen(buf);
	
	while (written < count) {
		retval=write(fd, &buf[written], 1);
		if (retval < 0) {
			perror("write failed\n");
			exit(-1);
		}
		if(retval==1)
			printf("%c",buf[written]);
		written+=retval;
	}
}


double getrand()
{
	int rnd;
	double randfloat;
	rnd=rand();
	return (double)rnd/(double)RAND_MAX;

	
}
int main(int argc,char *argv[])
{
	int fd;
	int count;
	char *devname;
	char tmpbuff[READLEN];
	int  i;
	if (argc != 2) {
		fprintf(stderr,"Usage:\n"
			"randsleep <hso application port>\n");
		return -1;
	}
	devname=argv[1];

	fd=open(devname,O_RDWR);
	if (fd<0) {
		perror("open failed");
		return -1;
	}
	signal(SIGALRM,sigalrm);
	atcmd_write(fd,"ATE0\r\n");
	atcmd_response_read(fd);
	for(i=0;;i++)
	{
		printf("\nLoop %d\n",i);
	        
		atcmd_write(fd,"AT\r\n");
		usleep(getrand()*(double)4000000);
		atcmd_response_read(fd);
		usleep(getrand()*(double)4000000);
	}

}

[-- Attachment #3: mk --]
[-- Type: text/plain, Size: 31 bytes --]

gcc randsleep.c -g -o randsleep

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-01-16 15:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-17 13:47 getting false SIGTRAP breakpoints in kernel i.e. kernel hung unless gdb remotely attached on x86 & cont is issued Denis Joseph Barrow
2008-09-17 13:55 ` Jason Wessel
2008-09-17 14:20   ` Denis Joseph Barrow
2008-09-18 14:53     ` Jason Wessel
2008-09-19 12:31       ` Denis Joseph Barrow
2008-09-19 12:57         ` Jason Wessel
2008-09-19 13:35           ` Denis Joseph Barrow
2008-09-19 19:38             ` Jason Wessel
     [not found]               ` <49708E50.8080103@option.com>
2009-01-16 15:58                 ` [PATCH]l gdb serial debugging appears be broken since at least 2.6.28-rc6 by tty layer now hopefully fixed Denis Joseph Barrow
2008-09-17 15:40   ` getting false SIGTRAP breakpoints in kernel i.e. kernel hung unless gdb remotely attached on x86 & cont is issued Denis Joseph Barrow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.