MrUser, your code is problematic. Consider the following 2 statements:
In the first statement, a mutable (modifiable or non-constant) string p is declared as an array of character and initialized with the string "test". The size of array p is 5 bytes including a null terminator. The result of *p = 'T' is defined and works as expected.
In the second statement an immutable (AKA constant) string litteral is declared and the base address of the memory where the compiler stores the string litteral is assigned to the pointer variable p. In this case, the result of *p = 'T' is undefined as you found out.
When you want a mutable string, i.e. a string which can be modified, use initialization instead of assignment.
Hi@all,
I try to compile c code on hpux 11.11 pa-risc 2 with gcc (32bit). I compile with the option -g, so that I get the symbol table, but it is not available. Does someone knows something on this?
thx (2 Replies)
Folks,
I have some program(Test.cpp) as follows,
#include<iostream>
class Abc
{
private:
int _theVar;
public :
int printVar();
};
int Abc :: printVar()
{
_theVar=10;
}
main()
{
Abc _t; (0 Replies)
Folks,
I have some program(Test.cpp) as follows,
#include<iostream>
class Abc
{
private:
int _theVar;
public :
int printVar();
};
int Abc :: printVar()
{
_theVar=10;
}
main()
{
Abc _t; (2 Replies)
Hi
I was wondering how can a c program will be implemented which will display a symbol while calculating something.
for example : program should display some charters like /\/\ while calculating.
At least provide some pointers
thanks (4 Replies)
Hello,
I'm working with putty on Windows 7 professional and I'd like to know if there's a way to gather specific lines from a pre-existing table and make a new table with that information.
More specifically, I'd like the program to look at a specific column, say column N, and see if any of the... (5 Replies)
I am new to this shell scripting....
I have a file which contains list of users. This files get updated when new user comes into the system.
I want to create script which will give a table containing unique list of users. When I say unique, it means script should match table while parsing... (3 Replies)
Bootstrap is great; but we have had some issues with Bootstrapped <tables> (and legacy <fieldset> elements) showing annoying, wayward lines. I solved that problem today with this simple jQuery in the footer:
<script>
$(function(){
$('tr, td, fieldset,... (0 Replies)
Hi,
I am a newbie in Linux land, and I have a question about programming parent/child process interaction:
How do I search the value of a symbol in the child process? Is it possible?
I am doing a fork() and execve() to spawn any child possible, and I need something on the parent side to... (12 Replies)
Discussion started by: alphakili
12 Replies
LEARN ABOUT NETBSD
ksyms
KSYMS(4) BSD Kernel Interfaces Manual KSYMS(4)NAME
ksyms -- kernel symbol table interface
SYNOPSIS
pseudo-device ksyms
DESCRIPTION
The /dev/ksyms character device provides a read-only interface to the current kernel symbol table. It can be accessed either as a sequential
file, where it looks like an executable file but with zero-sized text and data segments, or via ioctl(2).
/dev/ksyms represents the symbol table at the time when the device is opened, and may not change until it is closed.
The in-kernel symbol manager is designed to be able to handle any type of symbol table. However, only elf(5) symbol tables are currently
dealt with.
IOCTLS
The ioctl(2) command codes below are defined in <sys/ksyms.h>.
The (third) argument to the ioctl(2) should be a pointer to the type indicated.
KIOCGSIZE (int)
Returns the total size of the current symbol table. This should be used when allocating a buffer to read in the whole symbol
table to memory.
KIOCGVALUE (struct ksyms_gsymbol)
Returns the value for the given symbol name in a symtab-independent fashion.
struct ksyms_gsymbol {
const char *kg_name;
unsigned long *kg_value;
};
The struct element kg_name should be set to the name of the requested value, and the address that kg_value points to will
receive the symbol value.
KIOCGSYMBOL (struct ksyms_gsymbol)
Returns the complete symbol for the given symbol name.
struct ksyms_gsymbol {
const char *kg_name;
void *kg_sym;
};
The struct element kg_name should be set to the name of the requested symbol, and the found symbol will be written to the
kg_sym address. It is the callers responsibility to ensure that enough space for the symbol is allocated.
FILES
/dev/ksyms
SEE ALSO ioctl(2), nlist(3), elf(5)HISTORY
A ksyms device exists in many different operating systems. This implementation is modelled in function after Solaris ksyms. This ksyms
driver was written by Anders Magnusson for NetBSD.
The ksyms driver first appeared in NetBSD 2.0.
BSD November 12, 2008 BSD