Programming :: Seg Fault. Memory Address Not Being Passed To Function?

Apr 19, 2010

I am writing a game in C with SDL. I can successfully display one image on the screen and animate it. However, I am having a lot of issues getting the background to display using the same method. I was asking for help on SDL related forums, but I determined that the issue is not SDL related, and it is actually a pointer issue. However, I can't find where I'm going wrong.

Code:
#include <SDL/SDL.h>
struct image

[code]...

View 4 Replies


ADVERTISEMENT

Programming :: Value Gets Changed When Passed To A Function In C++

Jun 10, 2010

Why do I see different values of character 'a', in main() and in functionA() in the following C++ code?

Code:
#include <stdio.h>
#include <string.h>
#include <iostream>
using namespace std;

[Code]....

View 7 Replies View Related

Programming :: Python - Only Return Information For A Particular Function When A Flag Is Passed

Oct 28, 2010

I have a script that i want to add some functionality to, but im new to python. Right now it runs command line as ./script https://server user passwd verbose , which returns alot of informtion. I would like it to be able to only return information for a particular function when a flag is passed. exp: ./script https://server user passwd verbose -m (for memory only)

Under the ClassesToCheck section are the different things that can be retrieved. I would like that when you run the script as ./script https://server user passwd verbose -m, it returns only the 'Memory' info. -c would be for 'CPU', etc... Also, i would like the OK at the end of the script to be the first line that is return in the output instead of the last.

View 2 Replies View Related

Programming :: Seg Fault But No Memory References?

Apr 25, 2011

I can't figure out why I'm getting seg fault in this program im making in c++. The program is of the game "Mastermind" board game which I'm sure many of you might have heard of.im fairly new to coding c++. I do not know why I'm getting seg fault error when trying to compile as I'm not using any pointers? or trying to access memory that was not allocated to me?

View 5 Replies View Related

Programming :: Shared Memory Address Area In Process Address Space?

Feb 21, 2011

if i attach a shared memory to my process whch part of the address space it will add(like stack, heap, data, code...).

View 3 Replies View Related

Programming :: Getting Segmentation Fault Using Shared Memory?

Jan 8, 2011

I'm writing a producer-consumer program, where the producer and the consumer are different processes and they communicate using queued signals, and when I run it it comes out always 'segmentation fault'.

Here is my code:

(note: I tried using both 'shm_open()' and 'mmap()', and 'shmget()' and shmat()')

Code:

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>

[code]....

View 10 Replies View Related

Programming :: Access At Physical Address - I/O Address In My Map Memory?

Dec 17, 2008

When I try to access at physical address (0xD0000), we known that it is necessary to convert physical address to virtual address using function IOREMAP(0xD0000, 1024) and return me 0xC00D0000.

Now our doubt is when I have a board with I/O in address 0x150, is it necessary to convert this address to other virtual address??? or with inb(0x150) return me state of I/O in this address? How can I known where is this I/O address in my map memory?

View 7 Replies View Related

Programming :: Alloc_task_struct() Function Allocates 8 KB Task_union Memory Areas?

Dec 30, 2010

alloc_task_struct( ) This function allocates 8 KB task_union memory areas. The function takes memoryareas from the cacheif it is at least half-full or if there isn't a free pair of consecutive page frames available.

View 3 Replies View Related

Programming :: Memory Allocate In Function And Call It By Reference For Array Structure?

Jul 2, 2011

I am writing a function(in C language in Linux) to initialize an array of a structure from a mysql table by calling a function by reference but I have a problem with call this function by reference . this is my program:PHP Code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

[code]...

View 4 Replies View Related

Programming :: Realloc(): Invalid Next Size / Getting Error With Reallocate Memory In MakeDSt Function For DSt->SArray?

Jul 19, 2011

I wrote a test program for learning usage of realloc() and I thin I did everything right but I get this error exactly with my 4th time that while tries to reallocate memory in MakeDSt function for DSt->SArray:

Quote:

realloc(): invalid next size

this is my complete code :

Code:
#include <stdio.h>
#include <stdlib.h>
typedef struct DRA
{
code....

View 2 Replies View Related

Ubuntu Security :: ClamAV - Clamscan With Libclamav Error (opcode And Bytecode) Failed To Run: Invalid Argument Passed To Function

Jul 23, 2011

after upgrading ClamAV to version 0.97.1 and run the command Code: clamscan -r -i / --exclude-dir=^/sys --exclude-dir=^/dev --exclude-dir=^/proc | mail -s "clamav scan report XYSERVER" xy@mail.com the following errors appeared:

[Code].....

View 3 Replies View Related

Programming :: Shared Memory - Should They Show The Same Address?

Mar 17, 2010

So I'll try to be brief and to the point here: I've got a couple of C / C++ apps that communicate with one another via shared memory. These worked completely fine until.. well, about twenty minutes ago when I finished making some network card changes and suddenly, I've got a weird problem going on. At one point, Parent app waits for Child app to set a boolean indicating it's finished initialization. This worked fine the last time I ran this app up (a few days ago). But right now, the shared flag never seems to get triggered (I've added a printf("Waiting..."); in Parent app until the flag is set). All the code leading up to it being set in Child app seem to be running smoothly, so I tried spitting out the addresses of the shared memory locations. The addresses mapped by Parent app and Child app are different; this seemed odd, so I went back and wrote a simple miniature app that just opened a shared structure on my own box, and I get the same thing - different addresses - but the miniature apps work just fine.

Is it normal for a shared memory space to be mapped to two different addresses across two processes?

If so, does anyone have any idea what might be the issue at hand with my Parent / Child app scenario? The Child creates the shared memory, the Parent has a wait before it opens it, and if it doesn't exist should fail (opening with PROT_READ | PROT_WRITE)... it doesn't fail so it's evidently there.

All of this worked until literally just a few hours ago and I made some changes to my network cards, and I can't even imagine how that could have changed whether or not shared memory mapping worked...

View 2 Replies View Related

Programming :: Gdb Reports - Cannot Access Memory At Address 0x8049088

Jul 11, 2011

Kernel 2.6.21.5, slackware 12.0
nasm 2.03.01
ld 2.17
GNU gdb 6.6

This GDB was configured as "i486-slackware-linux".

Code:

What could the cause of the message output by gdb possibly be? Reading some tutorials, I've learn the flat memory model is used in linux. So, in particular, I needn't care about the DS segment register.

Also, line 7 in the listing above, suggests nasm is assuming 32-bit addressing and so, I think it is using the flat memory model.

View 3 Replies View Related

Programming :: Calculate Flash Memory End Address Of A Certain File?

Mar 9, 2011

how to calculate (if possible) the end address of an image file in a flash memory. I'm trying to create a checksum and checkheader function and the info that I got is the file's offset, how many sector it consumes and its size. I kinda need the end address, sad thing is, I don't know how to calculate it.test.img's start address is 0, the size is 0x20000 and consumes 3 sectors.

View 6 Replies View Related

Programming :: Find Physical Address Of Memory Provided By Kmalloc

Oct 22, 2009

I allocated a chunk of memory using kmalloc in a Device Driver. Kmalloc provides a pointer to the allocated memory. This is one of my first few drivers.

I assume that the address returned is a Virtual address. I need to find the physical address of the memory location. I am working on an Intel 64 bit Fedora machine. I used the virt_to_phys() routine present in <asm/io_64.h>. I found that this routine returns an unsigned long value (32 bit) instead of an unsigned long long value (64 bit). Moreover, it seems that it simply returns the address - OFFSET instead of extracting the value in the page tables.

So is there any function / system call in Linux which will allow me to see the actual physical address on the Intel 64 arch.

View 3 Replies View Related

General :: Application Virtual Address Space Memory Allocation - Memory Does Not Get Free

Apr 20, 2010

I am using malloc and frees a lot in my program. It shows its allocated but when i remove it doesnt show as the memory is removed(I am using the top command to view VIRT memory usage). If this continously grows what would happen to my program (Will it go out of memory?)

View 4 Replies View Related

Software :: Accessing Memory Address Outside Standard Memory

Nov 22, 2009

I am writing an application that wants to access periphals registers outside the standard (allowed) memory area.

Doing so gets me "segmentation fault".

I know, this is natural behaviour.

One way of getting around this is writing the module which has to be loaded by linux. I will consider this some time later.

For now, I want to come to some quick result and allow linux or gcc compiler to write to those memory areas of periphals. Is there a direct way to do so?

View 3 Replies View Related

Programming :: C - One Value In The Matrix Drops To Zero When Passed In As Pointer?

Dec 8, 2010

This is one of the strangest problems I've run into while programming. Maybe there's just something wrong with my version of gcc or something.

The main problem comes at this point in the code:

Code:
po = makePoFromScorbotXYZPR(X, Y, Z, P, R);
h = makeHB2GFromPo(po);
printf("%le", *h[1][0]); //##################################### Here it has the right value
printf("%s", "

[Code].....

View 2 Replies View Related

General :: Virtual Memory Address To Physical Address?

Apr 13, 2010

How can I get the physical address corresponding to a virtual address in linux by using /proc file system

View 1 Replies View Related

Programming :: How Can A Friend Function Access A Public Function From A Base Class

Nov 16, 2010

Code:
#include <iostream>
using namespace std;

[code]...

View 1 Replies View Related

Programming :: Passing Data From Interrupt Handler Function To Tasklet Function?

May 18, 2010

I am doing some Linux kernel programming for my research project. I need to record the timestamp (by using cpuid and rdtsc) when an interrupt handler (top half) is first invoked. Due to the time critical nature of the problem itself, I have to do the timestamping inside the interrupt handler itself (the first operation when the handler is called). However, I understand that tasks that are not so time critical should be deferred to a tasklet function (bottom half) for processing because other interrupts are disabled in a (top-half) interrupt handler. I am currently out of idea on how I can pass the timestamp information that I have obtained in the interrupt handler to the corresponding tasklet function.

View 2 Replies View Related

Slackware :: Installed The Latest Changes To Current - X Crashes And Reports A Segmentation Fault, Address Nil

Nov 14, 2010

X crashes and reports a segmentation fault, address nil. I've been using the generic Radeon driver without any problems, until now.

View 14 Replies View Related

Programming :: Memory Leaks - Glibc Detected - ./SuffixTree: Malloc() - Memory Corruption - 0x00

Mar 21, 2011

I am new to C and linux. My code below does arbitary writes but I cant figure out where or how it does it.

I am calling the insertNode() function with seq = 'MISSISSPPI$' and alphabets = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ$'

Code:

Weird behaviour I should mention is that when I check for NULL pointer in node->child[index], the unassigned values are not null anymore, they point to arbitary memory.

View 12 Replies View Related

Programming :: Write A Script That Can Show Me Total Memory Vs Used Memory?

Apr 13, 2010

How do I write a script for my Linux that can show me total memory vs used memory and have it email me results if it's over 70 percent?

View 2 Replies View Related

Programming :: Declaring A Function In A Function - C Programming

May 24, 2010

I want to declare a function in a function, but had no success till now, see the error code below and visit the project at sourceforge

[Code]...

View 14 Replies View Related

Programming :: Bash Array Add Function Example Using Indirect Array Reference As Function Argument?

Jun 20, 2010

I looked on the net for such function or example and didin't find anything, thus after having made one i guess it would be legitimate to drop it to see what others thinks of it.

#!/bin/bash
addelementtoarray()
{
local arrayname=$1

[code]....

View 10 Replies View Related

OpenSUSE :: Kmail And Address Book Search Function

Jul 28, 2010

When I try to write email, and enter the first few letters of the recipient in the "to:" box, it sometimes but not always autocompletes. i.e., let's say my contact's name is Frederick, his address is e.g. robertsharry@snotmail.com. I enter Fred or fred or fre, a couple of addresses come in to the autocomplete drop-down, but not his. After searching all over over to find his address by other means, I start to write it in manually only to find that he IS in my address book (and also in recent addresses), listed under Freddie. I know that the word Freddie is not in his actual address, but what is the point of having a search function if you have to remember the address yourself? In other words surely the drop down search should show display names (as well as any other fields)?

View 5 Replies View Related

Programming :: SHM Memory Counted As Cache Memory With Kernel 2.6.18?

Aug 25, 2010

Is that possible that SHM shared memory is counted as cache memory on Linux with kernel 2.6.18?If find it really odd since this memory is not file backed, but I have a piece of code that loads data using shm_open+mmap, and it generates an amount of cache memory in /proc/meminfo that corresponds exactly to the amount of shared memory (I load that data from a file but I am using posix_fadvise(fd,0,0,POSIX_FADV_DONTNEED) to ensure this file is not cached and I made sure that it is working as expected). As far as I know SHM memory was not tagged as cache memory with kernel 2.6.9.If it is the case it is really unfortunate since normally cache memory can be considered to be part of the "available" memory since it can be flushed promptly but this is clearly not the case with SHM memory... Is there an easy way to get the total amount of used SHM memory on a system?

View 4 Replies View Related

General :: Can't Statically Decide Virtual Address Of The Function At Compile Time?

Feb 8, 2010

I have read a couple of articles on how dynamic linking works (those stuff about got, plt and lazy binding), and I am still not sure why you need to do dynamic linking in such a complicated way.Suppose your program uses a function in a shared library that needs to be linked dynamically at run time (like a printf). Why can't you statically decide the virtual address of the function at compile time? After all, all you need to do is to enter the page table entry corresponding to the address of the function if the library has been already loaded to a physical page frame.

View 3 Replies View Related

Programming :: Pass Ip Address, Port Address And Some Parameters From Command Line?

Apr 1, 2011

I want to pass ip address,port address and some parameters from command line using python script.The ip address and port address for establishing socket connection and remaining parameters to execute different connection.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved