Unclear that you need to reanalyze between setting a property and getting it back

Ouverte Adaptée aux débutants
#8,689 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

Personne n'a encore pris cette issue.

Évaluation

Difficulté
1/5
Temps estimé
1-3 heures
Accessibilité débutants
78/100
Type d'issue
Documentation
Clarté
Clairement spécifiée
Activité
Active
Stack technique
python
Domaine
documentation

Piste de recherche

Commencez par docs/dev/concepts.md et docs/guide/index.md, puis examinez l’exemple cité dans l’issue #2295 pour voir ce qui reste confus. Clarifiez le comportement de la lecture des propriétés après une écriture et avant l’exécution de l’analyse, en particulier dans les scripts Python, et expliquez quand appeler bv.update_analysis_and_wait() ou current_function.reanalyze(). Le travail est terminé lorsque les lecteurs peuvent comprendre pourquoi une lecture peut renvoyer l’ancienne valeur et comment obtenir la valeur mise à jour.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Is this a general concept that needs to be documented or a specific API?
Large set of API properties/functions

What concept or API needs more documentation?
In many cases, if you set a property and then read it back, you get the old value; the new value only shows up after running analysis.

For example, if I run this as a single console command:

>>> print(current_function.type); current_function.type = 'int(void *)'; print(current_function.type)

I get the same type twice:

void(int32_t arg1, char** arg2) __noreturn
void(int32_t arg1, char** arg2) __noreturn

After running the command, the UI automatically reanalyzes, so if I then run:

>>> print(current_function.type)

I get the new one:

int32_t(void* arg1)

This is apparently by design, and it is documented, but the documentation is very vague.

docs/dev/concepts.md says:

This is a convenience the UI does for you just like if you were to change a type or create a function, you almost always want the analysis to be updated. However, in scripts you run yourself as plugins or via the "Run Script" command, you may not get the same results mid-execution until after the entire script is finished running.

This says you "want the analysis to be updated" and "may not get the same results", but it doesn't say how the results differ. I would have expected that updating the analysis would be necessary for the change to propagate to other parts of the binary, perhaps necessary for it to appear in the decompilation; I wouldn't have expected it to be necessary merely to read the thing I just wrote.

Likewise, docs/guide/index.md says:

When you run commands in the scripting console, the UI will automatically update analysis. This is because quite often when you make a change in the console you expect it to be immediately reflected in the UI. The same is not true when running a script where you must trigger bv.update_analysis_and_wait() or current_function.reanalyze() to experience the same behavior.

This makes it sound like skipping reanalysis only prevents changes from appearing "in the UI".

I don't know if there is other documentation I'm missing, but if not, this should be clarified.

Is this documentation related to a specific API?
Affects all, but especially Python where these properties are getters and setters (affecting user expectations).

Are there any known examples of people using this API/concept?
#2295 is an example of someone getting confused by this.

Langage dominant
C++
Étoiles
1.3k
Forks
304
Merge moyen
2 j 20 h
PR mergées (30 j)
10

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de Vector35/binaryninja-api

Toutes les issues de Vector35/binaryninja-api

Issues similaires

Plus d'issues C++

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.