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

Aberta Para iniciantes
#8,689 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 2 dias

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
1/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
78/100
Tipo de issue
Documentação
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
python
Domínio
documentation

Direção de pesquisa

Comece por docs/dev/concepts.md e docs/guide/index.md e, em seguida, revise o exemplo citado na issue #2295 para ver o que ainda está confuso. Esclareça como as leituras de propriedades se comportam após uma escrita e antes da execução da análise, especialmente em scripts Python, e explique quando chamar bv.update_analysis_and_wait() ou current_function.reanalyze(). O trabalho estará concluído quando os leitores conseguirem entender por que uma leitura pode retornar o valor antigo e como obter o valor atualizado.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
C++
Estrelas
1.3k
Forks
304
Merge médio
2d 20h
PRs com merge (30d)
10

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de Vector35/binaryninja-api

Todas as issues de Vector35/binaryninja-api

Issues semelhantes

Mais issues de C++

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.