From: George France <france@handhelds.org>
To: axp-list@redhat.com, "Ram Viswanadha" <ram@jtcsv.com>
Subject: Re: unaligned traps question
Date: Tue, 15 Oct 2002 11:33:48 -0400 [thread overview]
Message-ID: <02101511334803.01593@shadowfax.middleearth> (raw)
In-Reply-To: <01da01c273e4$d5c57320$35de2b09@Viswanadha>
[-- Attachment #1: Type: text/plain, Size: 1234 bytes --]
Hello Ram,
Attached is a program that will help you find the alignment
problems in ICU.
Best Regards,
--George
On Monday 14 October 2002 20:50, Ram Viswanadha wrote:
> Hi everyone,
> ICU (http://oss.software.ibm.com/icu/) libraries when compiled with stock
> RH 6.2 kernel and GCC used to produce unaligned traps in some of the tools.
> I upgraded to RH 7.2 (stock kernel and GCC) and now I am not seeing any
> unaligned trap messages.
> I read Rich Payne's mails in the archives and they suggest that the
> problems are in users code not in the kernel.
> So there are two possibilities, since my code has not changed:
> a) The kernel has become more lenient and is not producing any unaligned
> trap messages.
> b) GCC had a bug which produced unaligned data which has hence been fixed.
>
> Which of the above is true, or is there a better explanation to the above
> symptom.
>
> Thank you very much for your answer.
>
> Regards,
>
> Ram
> ---------------------------------------------------
> Ram Viswanadha
> International Components For Unicode
> GCoC San Jose
> IBM
>
>
>
> _______________________________________________
> Axp-list mailing list
> Axp-list@redhat.com
> https://listman.redhat.com/mailman/listinfo/axp-list
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: alignment.c --]
[-- Type: text/x-c; name="alignment.c", Size: 2729 bytes --]
#include <errno.h>
#include <stdio.h>
#ifndef __linux__
#include <sys/sysinfo.h>
#else
#include <asm/sysinfo.h>
#include <asm/unistd.h>
static int setsysinfo(unsigned long op, void *buffer, unsigned long size,
int *start, void *arg, unsigned long flag)
{
syscall(__NR_osf_setsysinfo, op, buffer, size, start, arg, flag);
}
#endif
static void usage(void)
{
fprintf(stderr,
"usage: unaligned <command-path> [command-args...]\n\n"
" This program is designed to assist debugging of\n"
" unaligned traps by running the program in gdb\n"
" and causing it to get SIGBUS when it encounters\n"
" an unaligned trap.\n\n"
" It is free software written by Sean Hunter <sean@uncarved.co.uk>\n"
" based on code by Richard Henderson and Andrew Morgan. It is provided\n"
" under the gnu public license without warrantees of any kind.\n\n");
exit(1);
}
void trap_unaligned(void)
{
unsigned int buf[2];
buf[0] = SSIN_UACPROC;
buf[1] = UAC_SIGBUS | UAC_NOPRINT;
setsysinfo(SSI_NVPAIRS, buf, 1, 0, 0, 0);
}
int main(int argc, char **argv)
{
char* tmp_filename;
char* my_debugger = "/usr/bin/gdb";
FILE* tmp_file;
int curr_arg;
/* check that we have at least 1 argument */
if (argc < 2) {
usage();
}
trap_unaligned();
if (argc > 2) {
/* add the extra args to a file to pass to gdb */
tmp_filename = tmpnam(NULL);
tmp_file = fopen(tmp_filename, "w+");
if (!tmp_file) {
fprintf(stderr, "Unable to create temp file %s reason: %s\n",
tmp_filename,
strerror(errno));
}
fprintf(tmp_file, "file %s\n", argv[1]);
fprintf(tmp_file, "set args");
for(curr_arg = 2; curr_arg < argc; curr_arg++) {
fprintf(tmp_file, " %s", argv[curr_arg]);
}
fprintf(tmp_file, "\n");
#ifndef NOAUTORUN
fprintf(tmp_file, "run\n");
#endif
fclose(tmp_file);
printf("Extra arguments passed to gdb in file %s.\n"
"Be sure to delete it when you're done.\n\n",
tmp_filename);
execlp(my_debugger, argv[1], "-x", tmp_filename, NULL);
}
else {
execlp(my_debugger, argv[1], NULL);
}
/* if we fall through to here, our exec failed -- announce the fact */
fprintf(stderr, "Unable to execute command: %s\n", strerror(errno));
usage();
}
next prev parent reply other threads:[~2002-10-15 15:34 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-15 0:50 unaligned traps question Ram Viswanadha
2002-10-15 1:38 ` Michal Jaegermann
2002-10-15 2:03 ` Uncle George
2002-10-15 15:39 ` George France
2002-10-15 16:46 ` Michal Jaegermann
2002-10-15 18:24 ` alvin
2002-10-15 19:33 ` George France
2002-10-15 19:40 ` Falk Hueffner
[not found] ` <3DAC6EF2.BC962839@voicenet.com>
2002-10-16 18:15 ` alvin
2002-10-16 19:18 ` George France
2002-10-16 19:45 ` Falk Hueffner
2002-10-16 20:08 ` George France
2002-10-17 18:37 ` Falk Hueffner
2002-10-16 20:23 ` Michal Jaegermann
2002-10-16 21:30 ` alvin
2002-10-17 1:47 ` Uncle George
2002-10-15 18:08 ` Uncle George
2002-10-15 19:29 ` George France
2002-10-15 20:10 ` Uncle George
2002-10-15 20:46 ` George France
2002-10-15 15:33 ` George France [this message]
2002-10-17 22:17 ` Ram Viswanadha
2002-10-18 15:36 ` Michal Jaegermann
2002-10-18 17:17 ` Ram Viswanadha
2002-10-18 18:47 ` Michal Jaegermann
[not found] <673E0A4C-E1DF-11D6-AC80-000393768D2C@mcgillsociety.org>
2002-10-17 15:50 ` George France
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox