This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


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

Re: [RFC] patch to fix finding sources


Fernando Nasser wrote:
> 
> !   filename = Tcl_GetStringFromObj (objv[1], NULL);
> !   st = full_lookup_symtab (filename);
>     if (st)
> !     Tcl_SetStringObj (result_ptr->obj_ptr, st->fullname, -1);
> !   else
>       {
> !       Tcl_SetStringObj ( result_ptr->obj_ptr,
> !                          "File not found in symtab (2)", -1);
>         return TCL_ERROR;
>       }

Martin,

If the symtab (st above) is non-NULL, then st->fullname is either non-NULL or has the value of st->filename.  As this was what was used to find the symtab we can be sure that it is not NULL.

So, after all, your comment was not so wrong.  It is not true when you don't get a symtab, but in that case there is no fullname field anyway.

And the code above is perfectly safe.  We can be paranoid and add a gdb_assert() on the st->fullname field but that would be something very hard to happen.


P.S.: I still depend on you to test my patch.  I still could not reproduce it here.



-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

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