473,386 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

"compile" problem

I'm trying to compile route.cpp part of the NetBench Suite (UCLA) and...:
g++ packet.cpp radix.cpp route.cpp -o route


There is no problem in the compilation of the code but when I try to run
it...

Segmentation fault (core dumped)

I've located where the problem is... It is part of the following function's
code:

int rtrequest(int req, class Sockaddr *Dst, class Sockaddr *Gateway, class
Sockaddr *Netmask, int flags, class rtentry **ret_nrt)
{
register class rtentry *rt;
register class radix_node *rn;
register class radix_node_head *rnh;
struct ifaddr *ifa;
class Sockaddr *Ndst;
....

rt->rt_ifp = (struct ifnet *) ifa->ifa_ifp;

....}

rt_ifp is of type struct ifnet *

I don't what to do to overcome the problem.
Any help is welcomed.
Thanks in advance

Alexander Bartzas
Jul 19 '05 #1
2 3055

"Alexander Bartzas" <am******@ee.duth.gr> wrote in message
news:be**********@nic.grnet.gr...
I'm trying to compile route.cpp part of the NetBench Suite (UCLA) and...:
g++ packet.cpp radix.cpp route.cpp -o route
There is no problem in the compilation of the code but when I try to run
it...

Segmentation fault (core dumped)

I've located where the problem is... It is part of the following

function's code:

int rtrequest(int req, class Sockaddr *Dst, class Sockaddr *Gateway, class
Sockaddr *Netmask, int flags, class rtentry **ret_nrt)
{
register class rtentry *rt;
register class radix_node *rn;
register class radix_node_head *rnh;
struct ifaddr *ifa;
class Sockaddr *Ndst;
...

rt->rt_ifp = (struct ifnet *) ifa->ifa_ifp;

...}

rt_ifp is of type struct ifnet *

I don't what to do to overcome the problem.
Any help is welcomed.
Thanks in advance

Alexander Bartzas


The normal way to solve this kind of problem is to use a debugger. Since you
are using g++ you should look at the gdb debugger. Most likely reason for
your crash is that ifa or rt are a NULL or otherwise invalid pointers. As
for why that should be, well the debugger will help you work it out.

john
Jul 19 '05 #2
"Alexander Bartzas" <am******@ee.duth.gr> wrote...
I'm trying to compile route.cpp part of the NetBench Suite (UCLA) and...:
g++ packet.cpp radix.cpp route.cpp -o route
There is no problem in the compilation of the code but when I try to run
it...

Segmentation fault (core dumped)

I've located where the problem is... It is part of the following

function's code:

int rtrequest(int req, class Sockaddr *Dst, class Sockaddr *Gateway, class
Sockaddr *Netmask, int flags, class rtentry **ret_nrt)
{
register class rtentry *rt;
'rt' here is a pointer to an object of type 'rtentry'. Which
object does it point to? Unknown. You didn't make it point
anywhere. It's uninitialised. Its value is random garbage.
register class radix_node *rn;
register class radix_node_head *rnh;
struct ifaddr *ifa;
'ifa' here is a pointer to some object of type 'ifaddr'. What
object does it point to? Unknown. Because it doesn't have
any value.
class Sockaddr *Ndst;
...
What's here? I presume there is nothing here that changes
the values of 'rt' or 'ifa'.

rt->rt_ifp = (struct ifnet *) ifa->ifa_ifp;
Here you dereference both 'rt' and 'ifa'. An attempt to
dereference a pointer whose value is garbage leads to what
you get, a segmentation fault. In terms of C++ you witness
"undefined behaviour".

...}

rt_ifp is of type struct ifnet *

I don't what to do to overcome the problem.


You need to make those pointers point somewhere real. Perhaps
you could find an example of what you're trying to accomplish.
Try looking on the Web. Neither 'rtentry', nor 'ifaddr' is
a standard type, so we cannot really help you give them correct
values.

Victor
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Vio | last post by:
I would like to know if executing: c = compile('a=5\nprint a','<string>','exec') on a Linux box, then pickling+beaming the result on a Windows box, will give me the expecting result: >>>...
22
by: Qopit | last post by:
Hi there, I'm pretty new to Python and am trying to figure out how to get "will this code compile?"-like code checking. To me this is a pretty basic language/environment requirement, especially...
3
by: Alexander Bartzas | last post by:
I'm trying to compile route.cpp part of the NetBench Suite (UCLA) and...: > cc packet.c radix.c route.c -o route There is no problem in the compilation of the code but when I try to run it......
1
by: Steve | last post by:
I get this message when I tried to make a .MDE of my database. "Compile error in hidden module: Form_frmPurchaseReq" I have been using this database for several months and just thought I would...
3
by: Randy Yates | last post by:
How-to-do? -- % Randy Yates % "And all that I can do %% Fuquay-Varina, NC % is say I'm sorry, %%% 919-577-9882 % that's the way it goes..." %%%%...
10
by: Chris LaJoie | last post by:
Our company has been developing a program in C# for some time now, and we haven't had any problems with it, but just last night something cropped up that has me, and everyone else, stumped. I...
2
by: Happy Li | last post by:
Need help! I have a project with one crystal report. How can I compile it with csc.exe. I have tried the following command line .it compile successfully..but when I run, it display error 'Unable...
16
by: John Kelsey | last post by:
Back in the "old" days with C, I used to do something like... struct { char Description; float price; } Items = { {"Apple", 1.99}, {"Banana", 2.04}
2
by: yinglcs | last post by:
I have the following code, which use template as the parent class of my other class. But I have "instantiated from here" compile error at this line: class C: public B2<A>. Can some one...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.