void
232     _gss_mg_error(struct _gss_mech_switch *m, OM_uint32 maj,
OM_uint32 min)
233     {
234             OM_uint32 major_status, minor_status;
235             OM_uint32 message_content;
236             struct mg_thread_ctx *mg;
237
238             mg = &last_error_context;
239
240             gss_release_buffer(&minor_status, &mg->maj_error);
241             gss_release_buffer(&minor_status, &mg->min_error);
242
243             mg->mech = &m->gm_mech_oid;
244             mg->maj_stat = maj;

when I give following comands, gdb tells me:

(gdb) p last_error_context
Cannot find thread-local variables on this target
(gdb) p &last_error_context
Cannot find thread-local variables on this target
(gdb) p mg
No symbol "mg" in current context.
(gdb)

I'm not sure if you're familiar with C or not.

This is because gdb's context is at the wrong frame. In the backtrace
you provided originally, you'd need to do:

(gdb) frame 2

To look at the variables associated with gss_display_status.c.

last_error_context could be an exported variable (you'd need to look
through the source to find out where it's declared), so you might have to print it with its source filename referenced. The print command I
gave you before (p/x filename.c::variable) didn't work, and that's a
surprise since the gdb documentation I read says it should.

Also be aware that mg is a struct, so "p mg" won't tell you much, other
than whether or not it's null.  You're probably more interested in
members of the struct, such as mg->maj_error and mg->min_error, and
other struct members.

I gave f 2 before entering the commands above, and unless I'm much mistaken, 'p mg' should at least give the pointer to the start of the struct in question, so 'No symbol "mg" in current context' is mildly interesting reply from GDB :) If I understand the code in question right the last_error_context's address should be copied to mg for accessing the error structure defined elsewhere in the scope of the while.

the definition is in same file and is as follows:

176 #if defined(__sparc64__) || defined(__arm__) || defined(__mips__)
177
178     /*
179 * These platforms don't support TLS on FreeBSD - threads will just
180      * have to step on each other's error values for now.
181      */
182     #define __thread
183
184     #endif
185
186     struct mg_thread_ctx {
187         gss_OID mech;
188         OM_uint32 maj_stat;
189         OM_uint32 min_stat;
190         gss_buffer_desc maj_error;
191         gss_buffer_desc min_error;
192     };
193     static __thread struct mg_thread_ctx last_error_context

-Reko
_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"

Reply via email to