This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Signed/unsigned character arrays are not strings


 > Does adding an appropriate (char *) cast fix the problem, and do you
 > think it's reasonable?

If you mean in .gdbinit, changing

define xprintstr
  set $data = $arg0->data
  output ($arg0->size > 1000) ? 0 : ($data[0])@($arg0->size_byte < 0 ? $arg0->size & ~gdb_array_mark_flag : $arg0->size_byte)
end

to:

define xprintstr
  set $data = $arg0->data
  output (char *) ($arg0->size > 1000) ? 0 : ($data[0])@($arg0->size_byte < 0 ? $arg0->size & ~gdb_array_mark_flag : $arg0->size_byte)
end

makes no difference.

I don't understand why unsigned chars should be printed as arrays except to
solve Jan's particular problem.  Maybe Emacs uses unsigned char for 8 bit
character sets like iso_8859-1:

2000-01-04  Gerd Moellmann  <gerd@gnu.org>

	* lisp.h (struct Lisp_String): Make DATA member `unsigned char *'.

Like another change that Ulrich Drepper is proposing (%a) this patch changes
existing behaviour.  Why not just add a new output format, or boolean variable?


-- 
Nick                                           http://www.inet.net.nz/~nickrob


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]