ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
again one silly question, how i can dump all the data members of task_struct structure into a file?? as the structure itself is very big and moreover its most of members are also pointers to other structure so what can be done in this case?? plz help me
My previous answer is assuming that the program is in C or C++, many other languages come with constructs to help you with the particular problem you are describing. But the pointers in a structure led me down the C path. If I've inferred incorrectly then the above answer may also be incorrect
You will need to write the code specific to the structure. Essentially using printf()'s to print out the data and when you come to a pointer dereference the data before printing.
On complex structures you may want to write a function for each sub structure so that you just call the dump function for the sub structure, quite useful if the structure includes an array of pointers to the same sub structure.
You need to be careful if the structure might hold a circular reference.
ok thank you for your reply. i think it will really help me ill try it and i'll again ask u if i'll find any problem. thank you for such a quick reply.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.