LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-19-2018, 11:39 AM   #1
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
debug output: deciphering help needed.


so what is this trying to tell me?
codeblocks :: debugger output.

this is a read directory recursively getting whatever file that is within a directory and its sub-directories. then before adding the files into a link list, it checks for an extension if it matches the criteria then it is called to add it to the front of a link list. it loads up a bunch then fails giving me this error.

I am wanting to get it to run through an entire hdd if called to do so, then only get the file types it is suppose to then load them into the link list without blowing up.

Code:
#0 0x7ffff707f428	__GI_raise(sig=sig@entry=6) (../sysdeps/unix/sysv/linux/raise.c:54)
#1 0x7ffff708102a	__GI_abort() (abort.c:89)
#2 0x7ffff70c72e8	__malloc_assert (assertion=assertion@entry=0x7ffff71db190 "(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) &&((unsigned long) (malloc.c:301)
#3 0x7ffff70cb426	sysmalloc(nb=nb@entry=48, av=av@entry=0x7ffff740eb20 <main_arena>) (malloc.c:2391)
#4 0x7ffff70cc743	_int_malloc(av=av@entry=0x7ffff740eb20 <main_arena>, bytes=bytes@entry=32) (malloc.c:3827)
#5 0x7ffff70ce184	__GI___libc_malloc(bytes=32) (malloc.c:2913)
#6 0x401ea6	add_2_front(filelist=0x6066d0 <filelist>, filename=0x760fd0 "/home/userx/Dropbox/images/eva green/thCAAB42OY.jpg") (/media/userx/b454fa4b-5a36-4124-af4f-9ad2e90eaf28/userx/C++Projects/wmslideshow/filelist.c:140)
#7 0x402614	add_file_to_filelist_recursively(origpath=0x760af0 "/home/userx/Dropbox/images/eva green/thCAAB42OY.jpg", level=1 '\001') (/media/userx/b454fa4b-5a36-4124-af4f-9ad2e90eaf28/userx/C++Projects/wmslideshow/filelist.c:352)
#8 0x40255b	add_file_to_filelist_recursively(origpath=0x760ee0 "/home/userx/Dropbox/images/eva green", level=1 '\001') (/media/userx/b454fa4b-5a36-4124-af4f-9ad2e90eaf28/userx/C++Projects/wmslideshow/filelist.c:335)
#9 0x40255b	add_file_to_filelist_recursively(origpath=0x61ace0 "/home/userx/Dropbox/images", level=1 '\001') (/media/userx/b454fa4b-5a36-4124-af4f-9ad2e90eaf28/userx/C++Projects/wmslideshow/filelist.c:335)
#10 0x40255b	add_file_to_filelist_recursively(origpath=0x7fffffffea5b "/home/userx/Dropbox", level=0 '\000') (/media/userx/b454fa4b-5a36-4124-af4f-9ad2e90eaf28/userx/C++Projects/wmslideshow/filelist.c:335)
#11 0x4036d6	main(argc=3, argv=0x7fffffffe738) (/media/userx/b454fa4b-5a36-4124-af4f-9ad2e90eaf28/userx/C++Projects/wmslideshow/main.c:164)

The thing is, that I can run this program on my other hdd the entire thing that has all kinds of files on it and it does not blow up. only in Dropbox and my /home/user dir,

when it is my home dir it grabs this file then fails.

Code:
bad path /home/userx/.mozilla/firefox/x22f7d38.default/lock
But that is a different issue all together.

In C++ for a different program I wrote this does not occur. But that is C++.

I'm not sure how much or which code one needs to look at to see from that debugger output. SO, if need be let me know what you think you'll be needing to look at in conjunction with this.

thanks.

Last edited by BW-userx; 04-19-2018 at 12:04 PM.
 
Old 04-19-2018, 12:53 PM   #2
bodqhrohro
Member
 
Registered: Apr 2018
Location: Ukraine
Distribution: Debian GNU/Linux 12
Posts: 62

Rep: Reputation: Disabled
There is a lot of assertions in backtrace so it's hard to distinguish which one causes the failure without reading the code. I have an interesting observation that both of file paths are slightly longer than 50 symbols. Maybe you have a memory corruption issue? Are buffer sizes enough for fitting any paths? Does the program process successfully any longer file paths before the failure?
 
1 members found this post helpful.
Old 04-19-2018, 01:14 PM   #3
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Original Poster
Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by bodqhrohro View Post
There is a lot of assertions in backtrace so it's hard to distinguish which one causes the failure without reading the code. I have an interesting observation that both of file paths are slightly longer than 50 symbols. Maybe you have a memory corruption issue? Are buffer sizes enough for fitting any paths? Does the program process successfully any longer file paths before the failure?


Code:
// in header I kicked it up to 2048

#ifndef PATH_MAX
#define PATH_MAX 2048 //1024
#endif // PATH_MAX

    char cwd[PATH_MAX];
    char fullpath[PATH_MAX];
    char temp[PATH_MAX];
let me go experiment with path lengths to see what I see. maybe kick it up further to see what that does as well.

Code:
char *get_absolute_path(char *path)
{

    char cwd[PATH_MAX];
    char fullpath[PATH_MAX];
    char temp[PATH_MAX];
    char *ret;

    if (!path)
        return(NULL);
    if (path[0] == '/' )
        return(strdup(path));
    /* This path is not relative. We're gonna convert it, so that a
       filelist file can be saved anywhere and feh will still find the
       images */

    /* I SHOULD be able to just use a simple realpath() here, but dumb *
       old Solaris's realpath doesn't return an absolute path if the
       path you give it is relative. Linux and BSD get this right... */
    if (getcwd(cwd, sizeof(cwd)) == NULL)
        printf("Cannot determine working directory:");
    snprintf(temp, sizeof(temp), "%s/%s", cwd, path);
    if (realpath(temp, fullpath) != NULL) {
        ret = strdup(fullpath);
    } else {
        ret = strdup(temp);
    }

    return(ret);
}
EDIT:

Ok I just made it 4096, and that worked (so far) one test only. I was thinking it may have been something to do with the linked list. but yeah, thanks!!!

marking solved.

Last edited by BW-userx; 04-19-2018 at 01:20 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash debug output fail rbees Programming 6 06-09-2015 11:37 AM
[SOLVED] Init isn't running - no output - how to debug? fmillion Linux From Scratch 7 05-14-2013 04:02 PM
Gnome 3 - debug output of Internet connection Sacha_D Linux - Newbie 1 07-01-2012 04:48 PM
[SOLVED] deciphering dd output schneidz Linux - Software 7 06-03-2009 12:39 PM
wpasupplicant + prism54 - can anyone debug this output? 66gdub Linux - Wireless Networking 1 11-30-2005 12:08 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration