linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Segmentation fault
@ 2000-08-10  6:52 Li Guangdong
  0 siblings, 0 replies; 4+ messages in thread
From: Li Guangdong @ 2000-08-10  6:52 UTC (permalink / raw)
  To: PPC mail list


Hi All,


When we run a GUI program on Hard Hat Linux(CDK1.0) on RPX-lite, it always
crashes with the message "Segmentation fault" or "Aborted" on the console
after manipulating the GUI windows for some time. It seems that something
wrong with the malloc() and free() functions.

And we found that, if malloc() (or __libc_malloc) is called continuously, it
seems OK. But if malloc() is called after freeing some previously allocated
blocks using free() (or __libc_free), we always get the message
"Segmentation fault".

By the way, this GUI program is built with g++ and "-static" option.

Could you please give your advice on this problem?

Thanks,
Kant


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Segmentation fault
@ 2000-10-06  8:39 H.S. Kim
  2000-10-06 13:57 ` Wolfgang Denk
  0 siblings, 1 reply; 4+ messages in thread
From: H.S. Kim @ 2000-10-06  8:39 UTC (permalink / raw)
  To: linuxppc-embedded


fitst, I week the english.

On the MBX860 board..
and NFS file system.

1.
I compiled the binutil, gcc,  kernel and glibc without errors.
binutil-2.20.0.26
gcc-2.95.2
mpc8xx-2.2.13
glibc-2.1.3

2.
And, I compiled the ash shell.
ash-linux-0.2

3.
And, I compiled the modutils.
modutils-2.3.9

4.
1, 2, 3 -> no error compiled and install.
but, ./modutils-2.3.9/insmod/insmod.c (refer to follow source)
first, segmentation error
==========================================
              if ((p = strrchr(filename, '/')) != NULL){
                      p++;
                      }
              else{
                      p = filename;
              }
*** Result ***
p = strrchr(filename,'/')  -> segmentation fault
================================================
So, i maked strrchr function.
==========================================
                len = strlen(p);

printf("MAIN_04_01\n");
                p=filename;
                for(i=len;i>0;i--)
                        p++;

printf("MAIN_04_02\n");
                for(i=1;i<=len;i++)
                        if(*(--p) == '/' ) {
                                p++;
                                break;
                        }
printf("MAIN_04_03\n");
                if(i<len)
                        p = filename;
***  Result  ****
len = strlen(p)   -> segmentation fault
=======================================
So, I remake strlen function
=======================================
              i=0;
              p=filename;
printf("MAIN_04_011\n");
              while(flag) {
printf("MAIN_04_012\n");
                      if(*(p) == '\0') flag=0;
printf("MAIN_04_013\n");
                      p++;
printf("MAIN_04_014\n");
                      i++;
              }
              len=i;

*** Result ***
MAIN_04_011
MAIN_04_012
Segmentation fault
======================================

But, when I make the simple program, no segmentation fault
==================================================
main(){

char *filename="fissslename";

 char  *p;
 char  *p1;
 char  ch;
 int i;
 int len;

p=filename;
len=strlen(filename);
printf("length=%d\n",len);
i=0;
while(1)
{
        if( *(p) == '\0') {printf("same\n"); break;}
        p++;
        i++;
        printf("%s\n",p);
}
printf("%d\n",i);

p1=(char *)malloc(i);
p1=filename;
printf("%s\n",p1);
}
*** Result ***
length=11
issslename
ssslename
sslename
slename
lename
ename
name
ame
me
e

same
11
fissslename
===============================================

The simple program excuted no segmentation.
but, insmod.c failed.

insmod.c and simple program has the same emvironment compile system and library.

what wrong??

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: Segmentation fault
  2000-10-06  8:39 Segmentation fault H.S. Kim
@ 2000-10-06 13:57 ` Wolfgang Denk
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2000-10-06 13:57 UTC (permalink / raw)
  To: linuxppc-embedded


Hello H.S. Kim,

first of all: please fix your mail setup!!!

> From: "H.S. Kim" <root@localhost.localdomain>

"root@localhost.localdomain" is NOT a valid email address!

In message <00100618093700.11698@localhost.localdomain> H.S. Kim wrote:
>
> I compiled the binutil, gcc,  kernel and glibc without errors.
> binutil-2.20.0.26
> gcc-2.95.2
> mpc8xx-2.2.13
> glibc-2.1.3
...
> *** Result ***
> p = strrchr(filename,'/')  -> segmentation fault

Building a cross-development environment for the MPC8xx is a
non-trivial task. There is some description in the Embedded PPC
HOWTO, and there are ready to use build scripts and/or images, for
instance from our web page
(http://www.denx.de/solutions-en.html#CDK), from MontaVista, RedHat,
and others.

Most probably you have made a mistake when building GCC and/or glibc.

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
A bore is someone who persists in holding his own views after we have
enlightened him with ours.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Segmentation fault
@ 2004-04-06 18:08 ppclinux
  0 siblings, 0 replies; 4+ messages in thread
From: ppclinux @ 2004-04-06 18:08 UTC (permalink / raw)
  To: linuxppc-embedded


Hello,
We have a Motorola-PPC8270 based inhouse blade which runs Uboot-1.0.2 and
Mvista 3.1 Linux.

We have succeeded in downloading the kernel by means of Uboots TFTP,
uncompress, start and NFS mount a rootfile system including Busybox.

However, when typing e.g. command "ls" we get a segmentation fault but
other commands like "cd" or "help" works fine. Could this be a incorrect
memory mapping problem? It seems that the Linux Kernel wants to fork a
process when doing e.g. "ls" and in that sequence fails and gets a
segmentation fault.

Happy for any guidance,

Cheers // Matias

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2004-04-06 18:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-10-06  8:39 Segmentation fault H.S. Kim
2000-10-06 13:57 ` Wolfgang Denk
  -- strict thread matches above, loose matches on Subject: below --
2004-04-06 18:08 ppclinux
2000-08-10  6:52 Li Guangdong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).