1

I am trying to assign a value using the solaris dbx debugger to a variable inside a names space. However, the debugger is saying that the variable doesn't exist within the namesspace. Using Sun studio 12.3 on solaris 10.

After putting some stops in, and running the program, i break somewhere other than the namespace at a higherlevel. i am able to see the namespace...

(dbx)>>whatis mynamespace
mynamespace is a namespace 

and even functions within the namespace...

(dbx)>>whatis specialfunction  
mynamespace::specialfunction is a function in namespace mynamespace

However, i can't access (assign or print) variables within the namespace.

(dbx)>>assign mynamespace::myvariable=0
No variable named myvariable is in namespace mynamespace.
(dbx)>>print mynamespace::myvariable
No variable named myvariable is in namespace mynamespace

I am going to try and stop in the namespace and see if that makes a difference. I have used gdb with this same code before without issue, but have had to transition to dbx because i couldn't get the version of gdb i have to work with a 64-bit program.

Adam Honse
  • 21
  • 2
  • So after poking around a bit, i think this is related to the current scope. I have to somehow get the visiting scope to be in the area i want to set the parameter, else it fails to find it. For ex, i'll add a stop to specialfunction and without continueing execution, i'll be able to print and assign values around that specialfunction. – Adam Honse Sep 13 '16 at 22:22
  • What happens with `assign ::mynamespace::myvariable=0`? If you're in namespace `x`, `dbx` may be trying to find `::x::mynamespace::myvariable`, since `mynamespace::myvariable` is an unanchored namespace. – Andrew Henle Sep 14 '16 at 14:16

0 Answers0