473,785 Members | 2,990 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"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 3077

"Alexander Bartzas" <am******@ee.du th.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.du th.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
1645
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: >>> exec(c) 5
22
4919
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 when working with large projects. It is *much* better to catch errors at "compile-time" rather than at run-time. One thing I've "found" is the PyChecker module (conveniently embedded in SPE), but it doesn't seem to do that great of a job. ...
3
664
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... Segmentation fault (core dumped) I've located where the problem is... It is part of the following function's
1
8003
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 make a .MDE of it and this message came up. Help said, something about a protected module or something..... Could someone enlighten me on this problem?
3
1985
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..." %%%% <yates@ieee.org> % Getting To The Point', *Balance of Power*, ELO http://home.earthlink.net/~yatescr
10
19730
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 have a struct that contains several different types of data. This struct is used throuout the program. Now, when I compile, I get 6 errors, all of them "Use of possibly unassigned field 'awayTime'" or "Use of possibly unassigned field 'intlTime'"....
2
7868
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 to find the report in the manifest resources'. csc.exe /target:exe /resource:source\abc.rpt,abcsystem.abc.rpt /lib:"C:\Program Files\Common Files\Crystal Decisions\1.1\Managed"...
16
10533
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
9955
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 please tell me why? class AI {
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10151
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3647
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.