This is the mail archive of the gdb-patches@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: [PATCH 05/16] cli, btrace: add btrace cli


> -----Original Message-----
> From: Jan Kratochvil [mailto:jan.kratochvil@redhat.com]
> Sent: Friday, June 01, 2012 8:42 PM

> > > But enable_btrace should error on its own as I have recommended.
> >
> > Will fix once the situation with gdbserver and shared code is clear.
>
> But this part is in gdb/btrace.c, there is 'error' always available.
>
> But I agree gdb/common/ currently cannot use it.

I am using error () in gdb proper and I further removed the use of errno
except for checking errors in syscall (), mmap (), and munmap ().

I'm not so sure what to do with gdbserver, though. I'm writing error messages
to stderr and write_enn () to the out buffer. The gdb side can then only print
that the operation failed. That's what others seem to do, as well.


[...]

> > If you're not OK with this, I can remove all the thread switching and
> > look for a solution in kgdb.
>
> Yes, it should be fixed kgdb.  I do not know the kgdb codebase, though.

I removed the thread switching.


> > > > +static void
> > > > +cmd_btrace (char *args, int from_tty) {
> > > > +  struct thread_info *thread = find_thread_ptid (inferior_ptid);
> > > > +  struct btrace_block *trace = NULL;
> > > > +  int flags = 0;
> > >
> > > Use enum.
> >
> > Flags is a bit-vector. The enum just provides names for the bits.
>
> It does not matter, you can enumval1 | enumval2 as long as they do not
> share any bits.  There is even specific pretty printer support for such 
> case:
> commit eb28de4a09f016d3de7caccec781eb70995a4001
> http://sourceware.org/bugzilla/show_bug.cgi?id=13281
> gdb.python/py-pp-maint.c
> +enum flag_enum
> +  {
> +    FLAG_1 = 1,
> +    FLAG_2 = 2,
> +    FLAG_3 = 4,
> +    ALL = FLAG_1 | FLAG_2 | FLAG_3
> +  };

This particular case is about gdb_disassembly () flags, which are defined via
macros. Sorry, my previous comment was wrong.

I did change it for btrace_list_flags (btrace.c) and for 
print_source_lines_flags
(symtab.h). Beware that this won't compile in C++.

Regards,
Markus.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

--------------------------------------------------------------------------------------
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland 
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Douglas Lusk, Peter Gleissner, Hannes Schwaderer
Registergericht: Muenchen HRB 47456 
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052

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